# DzLine3

A three dimensional line segment.

Inherits :

DAZ Script
DzVec3end
DzVec3origin

## Constructors

DAZ Script
DzLine3 ()
DzLine3 ( DzLine3 line )
DzLine3 ( DzVec3 origin, DzVec3 end )

## Methods

DAZ Script
DzVec3getDirection ()
DzVec3getPoint ( Number t )
Numberlength ( Number t=1.0 )
BooleanlinesIntersect ( DzLine3 line, DzVec3 intersection, Number tolerance=0.0 )
NumberminDistance ( DzVec3 pnt, Number s, Boolean clampEnds=false )
NumberminDistance ( DzLine3 line1, Number s, Number t )
NumberminDistanceSquared ( DzVec3 pnt, Number s, Boolean clampEnds=false )
voidnegate ()
BooleanplaneIntersect ( DzVec3 planePoint, DzVec3 planeNormal, Number t, DzVec3 intersection )
BooleansegmentsIntersect ( DzLine3 line, DzVec3 intersection, Number tolerance=0.0 )
voidsetLength ( Number length )
voidswapEnds ()

## Detailed Description

### Properties

Holds the line's ending point in three dimensional space.

Holds the line's starting point in three dimensional space.

### Constructors

DzLine3()

Default Constructor. Creates an uninitialized line.

DzLine3( DzLine3 line )

Copy Constructor.

DzLine3( DzVec3 origin, DzVec3 end )

Parameterized Constructor.

Parameter(s):

• origin - The origin point of the line.
• end - The end point of the line.

### Methods

Return Value:

• The vector direction of this line (end - origin).

Since:

• 4.9.3.121

DzVec3 : getPoint( Number t )

Return Value:

• The point with the given parametric distance along the line.

Since:

• 4.9.3.121

Number : length( Number t=1.0 )

Return Value:

• The length of the line given a parametric distance along the line.

Since:

• 4.9.3.121

Boolean : linesIntersect( DzLine3 line, DzVec3 intersection, Number tolerance=0.0 )

Tests the intersection of two lines. This line and the given line are assumed to be infinitely long in both directions (i.e. the intersection can be outside the origin-end segment of either line).

Parameter(s):

• line - The line to test intersection with.
• intersection - This vector will be set to the intersection point if the lines intersect.
• tolerance - If not zero, specifies the maximum distance between lines that will be counted as an intersection.

Return Value:

• `true` if this line intersects with the given line, otherwise `false`.

Since:

• 4.9.3.121

Number : minDistance( DzVec3 pnt, Number s, Boolean clampEnds=false )

Return Value:

• The minimum distance from this line to the given point. `s` is the parametric distance along the line to the minimum perpendicular distance point. If `clampEnds` is `true`, the parametric distance is clamped to the [0-1] range and the nearest point to the line segment is returned rather than the nearest distance to the infinite line formed by the two end points of the segment.

Since:

• 4.9.3.121

Number : minDistance( DzLine3 line1, Number s, Number t )

Parameter(s):

• line - The line to calculate min distance from.
• s - The parametric distance along this line.
• t - The parametric distance along the given line.

Return Value:

• The minimum distance between this line and another line.

Since:

• 4.9.3.121

Number : minDistanceSquared( DzVec3 pnt, Number s, Boolean clampEnds=false )

Return Value:

• The square of the minimum distance along the line to the minimum perpendicular distance point. If `clampEnds` is `true`, the parametric distance is clamped to the [0-1] range and the nearest point to the line segment is returned rather than the distance to the infinite line formed by two end points of a segment.

Since:

• 4.9.3.121

void : negate()

Reverses the direction of the line by mirroring the endpoint.

Since:

• 4.9.3.121

Boolean : planeIntersect( DzVec3 planePoint, DzVec3 planeNormal, Number t, DzVec3 intersection )

Calculates the intersection of this line and the plane specified. The plane is defined by a point on the plane and the normal to the plane.

Parameter(s):

• planePoint - A point on the plane (to define the plane).
• planeNormal - The normal to the plane (to define the plane).
• t - This will be set to the parametric distance along this line to the intersection point, if there is one.
• intersection - This vector will be set to the intersection point if the line and plane intersect.

Return Value:

• `true` if this line intersects the given plane, `false` if not (i.e. the two are parallel).

Since:

• 4.9.3.121

Boolean : segmentsIntersect( DzLine3 line, DzVec3 intersection, Number tolerance=0.0 )

Tests the intersection of two line segments.

Parameter(s):

• line - The line to test intersection with.
• intersection - This vector will be set to the intersection point if the lines intersect.
• tolerance - If not zero, specifies the maximum distance between lines that will be counted as an intersection.

Return Value:

• `true` if this line segment intersects with the given line segment, otherwise `false`.

Since:

• 4.9.3.121

void : setLength( Number length )

Sets the line to have the length given by setting the endpoint relative to the current origin.

Since:

• 4.9.3.121

void : swapEnds()

Swaps the origin for the endpoint.

Since:

• 4.9.3.121