weldx.geometry.LineSegment#

class weldx.geometry.LineSegment(points)#

Line segment.

Construct line segment.

Parameters

points (Quantity) – 2x2 matrix of points. The first column is the starting point and the second column the end point.

Return type

LineSegment

Examples

Create a ̧̧`LineSegment` starting at x=-1,``y=-2`` and ending at x=1, y=2

>>> from weldx import Q_, LineSegment
>>> point_data = Q_([[-1, 1], [-2, 2]], "mm")
>>> LineSegment(point_data)
<LineSegment>
Line:
    [-1.00 -2.00] mm -> [1.00 2.00] mm
Length:
    4.47 mm

Methods

apply_transformation

Apply an in-place transformation to the segment using a matrix.

apply_translation

Apply a translation in place.

construct_with_points

Construct a line segment with two points.

get_points

Get an array of the points at the specified relative positions.

get_section_length

Get the length from the start of the segment to the passed relative position.

linear_interpolation

Interpolate two line segments linearly.

rasterize

Get an array of discrete raster points of the segment.

transform

Create a new segment transformed by the passed matrix.

translate

Create a new segment translated by the passed vector.

Attributes

length

Get the length of the segment.

point_end

Get the end point of the segment.

point_start

Get the starting point of the segment.

points

Get the segments points in form of a 2x2 matrix.