[comp.graphics] AutoCAD question

rustcat@csli.STANFORD.EDU (Vallury Prabhakar) (06/26/88)

This question is directed towards all the AutoCAD gurus/hackers out there.
I looked into the entity-representation of polylines in the DXF portions
of the manual.  Apparently, all "sub-entities" of a polyline are stored
as VERTICES with additional flags indicating various other options.  One 
of these is the flag 42, whose value is associated with the so-called
"bulge" of the segment between two VERTICES.  This is defined to be 
"1/4 the included angle of the arc" and is set to 0.0 in the case of a
straight-line segment between the two vertices.  

Say, for example the two vertices are (x1, y1) and (x2, y2) with the value
of the bulge being z.  I can calculate the value of the included angle 
between the arc end-points by the above definition of the bulge.  Call this
angle A.  So, now I have two end-points and an included angle defining an
arc-segment.  It seems to me that this is not sufficient for uniquely
defining a circular arc.  Some piece of information appears to be missing.

Could any of you familiar with AutoCAD/AutoLISP tell me what this information
is?  I have an inkling that the arc is drawn in such a way that it has 
first-order continuity (slopes are same) with the immediately previous 
sub-entity of the polyline, but that's just a guess.  Or is it possible
that AutoCAD does some kind of a common spline operation to draw the arc?  
In any case, we would still need to know the tangent vector at the first
vertex, would we not? 

All this seems to be getting suspiciously messy.  Is there a more elegant/
simple way of figuring out the nature of various sub-entities in a polyline?
I was unable to find anything of that nature in the user-manual. 

I would really appreciate any answers to the above.  

Enjoy.

						-- Vallury Prabhakar
						-- rustcat@csli.stanford.edu


	

jbn@glacier.STANFORD.EDU (John B. Nagle) (06/27/88)

In article <4406@csli.STANFORD.EDU> rustcat@csli.UUCP (Vallury Prabhakar) writes:
>Say, for example the two vertices are (x1, y1) and (x2, y2) with the value
>of the bulge being z.  I can calculate the value of the included angle 
>between the arc end-points by the above definition of the bulge.  Call this
>angle A.  So, now I have two end-points and an included angle defining an
>arc-segment.  It seems to me that this is not sufficient for uniquely
>defining a circular arc.  Some piece of information appears to be missing.

     There are two data items, the "bulge" (type 42) and the "curve fit
tangent direction" (type 50) used to define the curvature of polyline arcs in
AutoCAD.  

     Splines are not used in AutoCAD's curve fitting.  Fitted curves
are composed strictly of arcs, with the arcs tangent at the endpoints.
Between each pair of vertices defined by the user, there will be two
arc segments, with an additional vertex introduced by the curve fitter.
The description on page 376 of the AutoCAD 2.6 manual describes how
this data is expressed in the .DXF file.

     The major advantage of restricting curves to circular arcs is that
the space of arcs is closed under rotation, translation, and cutting.
Thus, one can rotate, translate, and cut a polyline, repeatedly if
desired.  This is harder with splines; the complexity of the representation
grows under such operations.

					John Nagle