Segmentlists, Polygons | ![]() |
(std-pline-segs <pline>) ; =>segments from polyline
(std-pts->segs <pts>) ; points => straight segments
(std-segs->pts <segs>) ; segments => points
(std-segs-closed-p <segs>) ; closed segmentlist?
(std-polyedge <i> <pts> <len>) ; => i-th segment of pointlist
These functions provide methods and conversion functions, dealing with lists of segments.
A segmentlist or poly
is a complete geometrical representation of a curved or straight polyline (a so called "polygon").
STD-PLINE-SEGS
extracts the segmentlist from a POLYLINE or LWPOLYLINE entity. It returns the segment list for the polyline as a list of (p1 p2 [bulge]). A straight line has no bulge. Compute pts in the ECS (Enitity Corodinate System) of the pline. Segments from closedpolylines are closed as well.
STD-PTS->SEGS
converts a pointlist the a list of straight segments. Open polygons remain open, closed polygons are specified by adding the first point to the end of the polygon.
(p1 p2 p3) => ((p1 p2)(p2 p3)) ; open (p1 p2) => ((p1 p2)) ; straight single line (p1 p2 p3 p1) => ((p1 p2)(p2 p3)(p3 p1)) ; closed
STD-SEGS->PTS
converts a segmentlist the a list of points, ignoring bulges (=curves).
((p1 p2 0.5)(p2 p3)) => (p1 p2 p3)
STD-SEGS-CLOSED-P
returns T if the segmentlist specifies a closed polygon, if the endpoint of the last segment is equal the startpoint of the first segment.
T if p1 of the first segment is the same as p2 of the last.
Note: You might also need to check if the last segment is straight.
Note: Don't use it with pointlists! This is completely different.
STD-POLYE DGE
returns the i-th edge (straight segment) of a polygon given by a list of points of length len. It returns the i-th segment, starting with zero. The 3rd segment of a list of 4 points is the list of p4 and p1.
(std-polyedge 0 '(p1 p2 p3 p4) 4) => (p1 p2) (std-polyedge 1 '(p1 p2 p3 p4) 4) => (p2 p3) (std-polyedge 3 '(p1 p2 p3 p4) 4) => (p4 p1)
segs: A list of segments.
pts: A list of 2D or 3D points
pline: A Polyline or Lwpolyline entity given as entity, entget-list or entsel picklist.
i, len: Positive integer numbers
They may return a segmentlist, pointlist or segment.
The predicate std-segs-closed-p returns T or nil.
None.
(std-require 'STDPOINT)
Defined in STDPOINT
Note: Before version 0.4001 it was in STDENT!