openrndr / org.openrndr.shape / LineSegment

# LineSegment

`data class LineSegment : LinearType<LineSegment>` (source)

a 2D line segment

### Parameters

`start` - start of the line segment

`end` - end of the line segment

### Constructors

#### <init>

`LineSegment(x0: Double, y0: Double, x1: Double, y1: Double)`

a 2D line segment

`LineSegment(start: Vector2, end: Vector2)`

### Properties

#### contour

convert line segment to ShapeContour

`val contour: ShapeContour`

#### direction

direction of the line segment

`val direction: Vector2`

#### end

end of the line segment

`val end: Vector2`

#### normal

normal of the line segment, a unit length vector

`val normal: Vector2`

#### segment

convert line segment to Segment

`val segment: Segment`

#### shape

convert line segment to Shape

`val shape: Shape`

#### start

start of the line segment

`val start: Vector2`

### Functions

#### distance

find distance between the query point and the point on the line segment that is nearest to the query point

`fun distance(query: Vector2): Double`

#### div

`operator fun div(scale: Double): LineSegment`

#### extend

`fun extend(times: Double): LineSegment`

#### minus

`operator fun minus(right: LineSegment): LineSegment`

#### nearest

find point on the line segment that is nearest to the query point

`fun nearest(query: Vector2): Vector2`

#### plus

`operator fun plus(right: LineSegment): LineSegment`

#### position

calculate point on the line segment

`fun position(t: Double): Vector2`

#### rotate

rotate line segment around a point on the line segment

`fun rotate(degrees: Double, t: Double = 0.5): LineSegment`

#### split

split line segment at t-parameter value

`fun split(t: Double): Array<LineSegment>`

#### sub

calculate a sub line segment from t0 to t1

`fun sub(t0: Double, t1: Double): LineSegment`

#### times

`operator fun times(scale: Double): LineSegment`