Description : | This macro has been tested on AutoCAD 2002. The code should be adequately
commented for readability, also included within the comments is the technical
source from which the code is derived.
The macro limits itself to outputs ('POINT', '3DFACE', 'POLYLINE' + variants)
which may use discrete points, the rationale is documented within the macro.
The input can be vector or matrix depending on whether a surface or line is
desired. Scan the code for the input parameters which should be reasonably
self-explanatory
// The format is based around the Autodesk AutoCAD R11 specification for .DXF
files
//
// input input flag options DXF output
//
// 2..3 coords POINT
// 'POINT'--------> for arrays of points
// >6 vectors/matrices coords POLYLINE + VERTICES
// 'closed'
// 'polyface'
// 'tessa'
// 'N_closed'
// matrices '3DFACE' 3DFACE
// 'layer=[?..?]'
// 'color=[-256(?)..256]'
// 'handle_offset=??'
//
// assume polyline if vector input given
// assume polymesh if matrix input given and 'POINT' not specified
'tessa' may require some explanation. This is a format whereby input matrices
can create triangular meshes.
Basically:
(0,0) - (0,1) - (0,2) - ... (0,m)
| \ | \ | \ |
| \ | \ | \ . |
| \ | \ | . . |
| \ | \ | . \ |
(1,0) - (1,1) - (1,2) - ... (1,m)
| \ | \ | \ |
| \ | \ | \ . |
| \ | \ | . . |
| \ | \ | . \ |
(2,0) - (2,1) - (2,2) - ... (2,m)
| \ | \ | \ |
. . . . . . . .
. . . . . . . .
. . . . . . \ .
(n,0) - (n,1) - (n,2) - ... (n,m)
so the first triangle is formed by the elements {X(0,0), Y(0,0)},{X(1,0),
Y(1,0)},{X(1,1), Y(1,1)} where X and Y are n x m matrices. Note Z is optional,
a matrix of zeros is created if no Z coords are given, or if a single value is
given, this is treated as z .* ones(size(X,1), size(X,2))
In other words diagonal connections are drawn.
|