Coons 101
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 12:35 PM
Basically, if you create four (three-dimensional lines, thus) EDGES in space, and the corners of the lines intersect each other, you will have a description for a surface. The points on the surfaces are interpolated from the opposing edges. Think of two people holding a blanket.
The 'tricky' part is working out the formula / points for the four sides.
Note that the end points of each line have to be coincident (the same) otherwise you'll get a gdl error.
In the coil here I 'cheated' by setting two of the lines to zero (thus generating a 'pointed' end.
We'll come back to the 'spiral code' after the following example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 12:49 PM
Hopefully the illustration below is clear?
Within the - admittedly clumsy - GDL below we first define the four curves,
and then 'put' them to the stack, in order.
The syntax of the coons command is;
coons PointsOnLines1&3, PointsOnLines2&4, status code,
Line1-X1, Line1-Y1, Line1-Z1,
Line1-X2, Line1-Y2, Line1-Z2,
...
Line4-X8, Line4-Y8, Line4-Z8
Example script:
oX=1 : oY=2 : oZ=3 !=== I do this for convenience
dim oLineX1 [8][3]
dim oLineX2 [8][3]
dim oLineY1 [8][3]
dim oLineY2 [8][3]
!=== calculate edge curves
for i=0 to 7
oLineX1 [i+1][oX] = i
oLineX1 [i+1][oY] = 0
oLineX1 [i+1][oZ] = i * 3/7
oLineX2 [i+1][oX] = i
oLineX2 [i+1][oY] = 7 + sin(i*180/7)
oLineX2 [i+1][oZ] = 3
oLineY1 [i+1][oX] = 0
oLineY1 [i+1][oY] = i
oLineY1 [i+1][oZ] = i * 3/7
oLineY2 [i+1][oX] = 7
oLineY2 [i+1][oY] = i
oLineY2 [i+1][oZ] = 3 + sin(i*180/7)
next i
!=== 'put' coordinates, in order
for i=0 to 7
put oLineX1 [i+1][oX]
put oLineX1 [i+1][oY]
put oLineX1 [i+1][oZ]
next i
for i=0 to 7
put oLineX2 [i+1][oX]
put oLineX2 [i+1][oY]
put oLineX2 [i+1][oZ]
next i
for i=0 to 7
put oLineY1 [i+1][oX]
put oLineY1 [i+1][oY]
put oLineY1 [i+1][oZ]
next i
for i=0 to 7
put oLineY2 [i+1][oX]
put oLineY2 [i+1][oY]
put oLineY2 [i+1][oZ]
next i
!=== perform coons command
coons 8, 8, 32+16+8+4,
get (24),
get (24),
get (24),
get (24)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 01:22 PM
Hopefully the script + illustration is clear?
oSegments = 0100 !=== no. of segments
oRadius = 0005 !=== helix diameter
oWidth = 0002 !=== width of band
oAngle = 1500 !=== total revolved angle
oLength = 0050 !=== total length
!=== put 'internal spiral' (X1)
for i=0 to oAngle step oAngle/oSegments
put oRadius * cos(i) - oWidth * cos(i)
put oRadius * sin(i) - oWidth * sin(i)
put i/oAngle*oLength
next i
!=== put 'external spiral' (X2)
for i=0 to oAngle step oAngle/oSegments
put oRadius * cos(i) + oWidth * cos(i)
put oRadius * sin(i) + oWidth * sin(i)
put i/oAngle*oLength
next i
!=== put bottom line (Y1) and the top line (Y2)
for i=0 to oAngle step oAngle
!=== internal point (A)
put oRadius * cos(i) - oWidth * cos(i)
put oRadius * sin(i) - oWidth * sin(i)
put i/oAngle*oLength
!=== external point (B)
put oRadius * cos(i) + oWidth * cos(i)
put oRadius * sin(i) + oWidth * sin(i)
put i/oAngle*oLength
next i
!=== note that there are four points (3x4=12 coordinate values) for the top & bottom lines, and six values (three (X,Y,Z) 'inside' and three 'outside') for the 'spiral' lines, hence (nsp-12)/6...
coons (nsp-12)/6, 2, 60, get (nsp)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 01:39 PM
1. Coons are really not supposed to be spiral but the GDL engine allows it, so why not

2. The GDL engine can be quite fussy about the corner points (the 'famous' accuracy issue) so for 'robust' scripts it would be 'a good idea' to set the start/end points of the 'Y' lines to be the same as the end/start points of the 'X' lines (rather than use calculated solutions).
In our next lesson we'll cover vert, edge, vect & the pgon commands

PS. I haven't checked, but doesn't DnC cover this in his *highly recommended* cookbook??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 03:59 PM
StuartJames wrote:As clear as an Efels Pilsen!
Hopefully the script + illustration is clear?
Even the 'sin(i/oAn*180)' bit that you omitted is now understandable. Very clever!
Thanks for the lesson. I'll print it and attach to my CookBook.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-19 08:57 PM
StuartJames wrote:Oh Yes, Stuart, Please!
In our next lesson we'll cover vert, edge, vect & the pgon commandsNOT !

Thanks for these examples and the nice scripts.
My only regret is that coons is only a surface, not a volume, no way for SEO.

Do you have a solution for this?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-22 02:47 PM
Olivier wrote:Maybe four coons, with similar mathematics, two for the laid down surfaces, and two more for the 'walls'?
My only regret is that coons is only a surface, not a volume, no way for SEO.![]()
Do you have a solution for this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-29 05:08 AM
StuartJames wrote:It is remarkable that you discovered this, Stuart!
1. Coons are really not supposed to be spiral but the GDL engine allows it, so why not
I finally read through your tutorial today. Really well done and an excellent contribution that belongs in the tips, ArchiGuide or Cookbook 4. Cookbook 3 does talk about Coons, but your lesson and examples are much more clear IMHO.
Thanks!

Karl

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-29 05:43 AM
Not surprisingly, since ArchiForma sends the 3D polyline points to a GDL Coons, spirals/etc can be made here, too. (For a spiral, I think doing the math in GDL is quite a bit easier than trying to draw precisely, and results in the perfection shown by Stuart.)
The cool thing about creating Coons surfaces in ArchiForma is that the resulting surface is editable! In the 3D window, editable hotspots at each point of each line allow you to change the position of that point. One hotspot lets you change the elevation (z), the other lets you move the point in the x-y plane. It's like playing with clay.
(The 3D polylines that you use to create the 4 edges are similarly editable.)
AF 2.01 also has a 2-D edit mode option for most elements that it creates, allowing graphical hotspot editing of the x/y/z values of every point while in plan. Brilliantly done, Cigraph!
Karl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2004-11-29 10:52 AM

Thanks for all the flowers, guys!
Olivier; ok, when I have time I will do a 'demonstration' of the primitive 3d commands, promise. Actually they aren't as scary as they look!
Durval; I have never tried SEO's with planar objects (never felt the need to cut up something described geometrically). Does it work?? I would guess that it probably does - but maybe with occasional errors. Risky.
Karl; I don't have ArchiForma (yet?) - but Coons are generally a remarkably simple way to describe many 'objects' and (hollow) volumes. They deserve a better reputation than that which the GS help guide serves to imbue!
- Stuart