distance3d.distance.line_to_rectangle

distance3d.distance.line_to_rectangle(line_point, line_direction, rectangle_center, rectangle_axes, rectangle_lengths, epsilon=1e-06)[source]

Compute the shortest distance between line and rectangle.

Implementation adapted from 3D Game Engine Design by David H. Eberly.

Geometric Tools, Inc. http://www.geometrictools.com Copyright (c) 1998-2006. All Rights Reserved

The Wild Magic Version 4 Foundation Library source code is supplied under the terms of the license agreement (http://www.geometrictools.com/License/Wm4FoundationLicense.pdf) and may not be copied or disclosed except in accordance with the terms of that agreement.

Parameters:
line_pointarray, shape (3,)

Point on line.

line_directionarray, shape (3,)

Direction of the line. This is assumed to be of unit length.

rectangle_centerarray, shape (3,)

Center point of the rectangle.

rectangle_axesarray, shape (2, 3)

Each row is a vector of unit length, indicating the direction of one axis of the rectangle. Both vectors are orthogonal.

rectangle_lengthsarray, shape (2,)

Lengths of the two sides of the rectangle.

epsilonfloat, optional (default: 1e-6)

Values smaller than epsilon are considered to be 0.

Returns:
distfloat

The shortest distance between line and rectangle.

closest_point_linearray, shape (3,)

Closest point on the line.

closest_point_rectanglearray, shape (3,)

Closest point on the rectangle.