Segment Structure


Synopsis

(std-make-seg <p1> <p2> <bulge>) ; create a segment, bulge may be nil

(std-seg-p <x>) ; Is it a segment?

(std-seg-p1 <seg>) ; first point of segment

(std-seg-p2 <seg>) ; second point of segment

(std-seg-bulge <seg>) ; bulge of segment or nil

Description

This is the structured schema for geometric segments consisting of two points and a bulge, which is widely used in AutoCAD polylines. This segment is able to hold the compact and fast definition of an arc or a line.

The constructor STD-MAKE-SEG is used to create the segment and the three accessors to return the specific values from the segment. This is abstracted away from simple list functions to be able to enhance the data structure of the segment and the logic of all functions using these. We might also consider extending these segments to curves of higher polynomial degree (splines).

STD-SEG-P is a predicate to determine if the object is a segment. This might be important when the data structure is not represented as list anymore, such as with AutoCAD 2000 SAFEARRAY's. (a possible future enhancement)

Segment structure: (p1 p2 [bulge])

Straight segments may consist of only two points without the bulge.

The bulge given to STD-MAKE-SEG may be zero or nil.

STD-SEG-BULGE always returns nil for a zero bulge. That means it may be used as predicate as well, as complement to STD-SEG-STRAIGHT-P.

(STD-SEG-STRAIGHT-P) == (NOT (STD-SEG-BULGE SEG))

For the definition of the bulge see the various bulge handling functions.

Examples

;;

Arguments

seg: A segment list, returned by std-make-seg.

p1,p2: A 2D or 3D point

bulge: Any number or nil. A nil value means 0 and represents a straight line.

Return Value

STD-MAKE-SEG returns a segment list, the others return a point, a number or nil.

Side Effects

None.

Module

(std-require 'STDPOINT)

Defined in STDPOINT

Note: Before version 0.4001 it was in STDENT!