[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Polygon Problems
- Subject: Re: Polygon Problems
- From: Ronn Kling <ronn(at)rlkling.com>
- Date: Wed, 29 Mar 2000 23:03:05 GMT
- Newsgroups: comp.lang.idl-pvwave
- Organization: Deja.com - Before you buy.
- References: <firstname.lastname@example.org>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:19084
I agree that what you describe is a problem. I pulled something
together that is included below that at least solves part of the line
problem. What you have to do is to create a polyline object in another
model, but offset the model by a small amount in the z direction.
However, the polyline object suffers from the same problem as the
surface object. They just aren't set up for cases with more faces than
vertices. This is really obvious when you run the example below.
I looked at the teapot demo source code, it is part of the normal
distribution. Look under rsi/idl53/examples/demo/demosrc. It appears
that the way RSI solved this with the teapot is to add points in the
center of a polygon, In your octahedron example you would have to add
point in the center of the face and thereby artificially create more
I hope this helps a little.
Ronn Kling Consulting
Application Development with IDL book at : http://www.rlkling.com
UPDATED FOR IDL 5.3!
Shareware and Freeware at: http://www.rlkling.com/
---------- CUT HERE -----------------------------
rt2 = sqrt(2.0)
vertex_array = [ $
poly_array = [ $
s = OBJ_NEW("IDLgrPolygon", data=vertex_array, $
myview = [-0.5,-0.5,1,1]
; Create view.
oView = OBJ_NEW('idlgrview', PROJECTION=2, EYE=3, ZCLIP=[1.5,-1.5],$
; Create model for the geometric objects.
oModelTop = OBJ_NEW('IDLgrModel')
oModelSurface = OBJ_NEW('IDLgrModel')
oSurface = octahedron()
;giving this a slight offset makes the lines visible.
oModelOffset = OBJ_NEW('IDLgrModel')
oModelOffset->translate, 0, 0, 0.005 ;Offset Z to make visible
oModelEdges = OBJ_NEW('IDLgrModel')
oLine = OBJ_NEW('IDLgrPolyline', SHARE_DATA=oSurface, POLY=pmesh, $
oModelEdges->add, oLine ;Add the edging data
;make object smaller
scs = 0.3
oModelTop->Scale, scs, scs, scs
; Create the vertex colors and make the 3-D objects
; to have these color.
vc = BYTARR(3, 8, /NOZERO)
sat = 1.0
val = 1.0
ic = 0
for i = 45, 360,45 do begin
angle = i
Color_convert, angle, sat, val, red, green, blue, /HSV_RGB
vc(0, ic) = red
vc(1, ic) = green
vc(2, ic) = blue
ic = ic + 1
oSurface -> SetProperty, VERT_COLORS=vc
; Create a light
oLight3 = OBJ_NEW('IDLgrLight', LOCATION=[0,0,5], TYPE=0, $
; Place the model in the view.
;make a window
oWindow = OBJ_NEW('IDLgrWindow',dim=[400,400])
;rotate the object to see the problem
;Note that the lines have the same problem as the color.
;They only show up along some edges.
for i=0,360,5 do begin
for i=0,360,5 do begin
Sent via Deja.com http://www.deja.com/
Before you buy.