The Line3D module

PR 28753 The Python method Line3D.Line3D.colinear has been improved. Formerly, it would sometimes incorrectly judge two lines to be colinear, particularly if one of the lines was short and distant from the other line. (v7.3)

The Line3D module lets you construct a Line3D and contains various functions for comparing interrelationships between two Line3Ds. A Line3D can be constructed from two Point3D s as the following example shows:

Line3D(Point3D(-5, 0, 0), Point3D(5, 0, 0))

Here's some examples generated at the SDS2 Python Prompt :

SDS2 Python Prompt

>>> from Line3D import*
>>> from Point3D import *
>>> x = Line3D(Point3D(-5, 0, 0), Point3D(5, 0, 0))      # horizontal line
>>> y = Line3D(Point3D(0, -5, 0), Point3D(0, 5, 0))      # vertical line
>>> x.Distance(y)
0.0                                                                                        # the lines intersect
>>>
>>> Line3D.Distance(x,y)
0.0                                                                                        # same result
>>>
>>> Line3D.Intersection(x,y)
Point3D(0, 0, 0)                                                                  # x,y intersection point
>>>
>>> Line3D.Parallel(x,y)
False                                                                                    # x,y not parallel

To get documentation on the Line3D module, you can use the SDS2 Python Prompt and the built-in Python functions dir() and help() :

SDS2 Python Prompt

>>> import Line3D                           # import the module
>>>
>>> dir(Line3D)                                # do a dir() on the module name
['Line3D', '__doc__', '__name__', '__package__']
>>>
>>> help(Line3D)                             # help on Line3D
Help on module Line3D:

NAME
Line3D

FILE
(built-in)

CLASSES
Boost.Python.instance(__builtin__.object)
Line3D

class Line3D(Boost.Python.instance)
| Method resolution order:
| Line3D
| Boost.Python.instance
| __builtin__.object
|
| Methods defined here:
|
| Angle(...)                                           # help on Angle()
| C++ signature:
| Angle(Line3D {lvalue}, Line3D) -> double
|
| colinear(...)                                      # help on colinear()
| colinearity of two lines is defined as follows:
| Let the two points on the first line be AB and the two points
| on the second line be CD.
|
| The lines are considered colinear iff C and D both lie
| within 0.001 units of the infinite line AB, and both of A and B lie
| within 0.001 units of the infinite line CD, and the absolute value
| of the cosine of the angle between the direction vector B-A
| and the direction vector D-C is greater than than (1-5e-7)
| (about .001 radians or .06 degrees). The last condition
| addresses the case of two very short perpendicular segments.
|
| C++ signature:
| colinear(Line3D {lvalue}, Line3D) -> bool
|
| Coplanar(...)                                        # help on Coplanar()
| C++ signature:
| Coplanar(Line3D {lvalue}, Line3D, double) -> bool
|
| Distance(...)                                         # help on Distance()
| C++ signature:
| Distance(Line3D {lvalue}, Point3D) -> double
| C++ signature:
| Distance(Line3D {lvalue}, Line3D) -> double
|
| GetVector(...)                                       # help on GetVector()
| C++ signature:
| GetVector(Line3D {lvalue}, Point3D {lvalue}) -> bool
|
| Intersection(...)                                      # help on Intersecton()
| C++ signature:
| Intersection(Line3D {lvalue}, Line3D) -> Point3D
|
| Parallel(...)                                             # help on Parallel()
| C++ signature:
| Parallel(Line3D {lvalue}, Line3D) -> bool

page 1 | contents | modules | top