|
|
Description
T%ARE-POINTS-COPLANAR is an AutoLisp Sub-Function, by CadToolChest, which functions within AutoCAD 2002, and later (possibly earlier). It determines if 3 or more 2D or 3D points are coplanar, and returns a 3 element list with the 1st element being T if all points are coplanar, or nil otherwise. The 2nd element is a list of all points that are coplanar (always includes the first 3 non-collinear points of the argument to this function). The 3rd element is a list of all points that are not coplanar and elements that are not 2D/3D points, or nil if all elements are coplanar points.
Note: If an element of the list is not a 2D or 3D point, the test will consider that element as non-coplanar and therfore consider the entire list as non-coplanar.
This function requires an additional CadToolChest file which must be downloaded separately (see left margin).
Syntax:
(T%ARE-POINTS-COPLANAR POINT-LIST)
Where:
POINT-LIST=A list of 3 or more 2D or 3D points to be compared. The first three define a plane to which the remaining points will be compared.
Example 1:
(T%ARE-POINTS-COPLANAR (list (list 0.0 0.0 0.0) (list 10.0 0.0 0.0) (list 10.0 5.0 0.0) (list 0.0 5.0 0.0)))
Returns: (T ((0.0 0.0 0.0) (10.0 0.0 0.0) (10.0 5.0 0.0) (0.0 5.0 0.0)) nil)
Example 2:
(T%ARE-POINTS-COPLANAR (list (list 0.0 0.0 0.0) (list 10.0 0.0 5.0) (list 10.0 5.0 5.0) (list 0.0 5.0 0.0)))
Returns: (T ((0.0 0.0 0.0) (10.0 0.0 5.0) (10.0 5.0 5.0) (0.0 5.0 0.0)) nil)
Example 3:
(T%ARE-POINTS-COPLANAR (list (list 0.0 0.0 0.0) (list 10.0 0.0 0.0) (list 10.0 5.0 0.0) (list 5.0 5.0 5.0) (list 6.0 6.0 6.0)))
Returns: (nil ((0.0 0.0 0.0) (10.0 0.0 0.0) (10.0 5.0 0.0)) ((5.0 5.0 5.0) (6.0 6.0 6.0)))
Note: Always check the CAR of the returned list to determine if T or Nil a list is always returned making the return True. For example:
(if (car T%Are-Points-Coplanar Point-List))
(prompt "\nTrue")
(prompt "\nNIL")
) ;_ if
|
|
<Back
|
This program is distributed, by CadToolChest, as Freeware without guarantee or
warranty of any type. You may freely use, modify and/or distribute this
program for personal or commercial use, but you may not sell or charge for it
or any portion of it. If bundled with a product that is sold, you must
make this program available for free. As customary, acknowledge the
original author's contribution if you build upon or distribute this work.
The author of CadToolChest retains all copyrights other than described above.
|