 # TSegment2

## 2D Line Segment stored as Center point, normalized Direction vector, and scalar Extent

References

Syntax

template<typename T>
struct TSegment2

Remarks

2D Line Segment stored as Center point, normalized Direction vector, and scalar Extent

Variables

Name Description

FVector2< T >

Center

Center point of segment

FVector2< T >

Direction

Normalized Direction vector of segment

T

Extent

Extent of segment, which is half the total length

Constructors

Name Description

TSegment2()

TSegment2

(
const FVector2< T >& Point0,
const FVector2< T >& Point1
)

Construct a Segment from two Points

TSegment2

(
const FVector2< T >& CenterIn,
const FVector2< T >& DirectionIn,
T ExtentIn
)

Construct a segment from a Center Point, normalized Direction, and scalar Extent

Functions

Name Description

T

DistanceSquared

(
const FVector2< T >& Point,
T& DistParameterOut
)

T

DistanceSquared

(
const FVector2< T >& Point
)

FVector2< T ...

EndPoint()

T

FastDistanceSquared

(
const FVector2< T >& StartPt,
const FVector2< T >& EndPt,
const FVector2< T >& QueryPt,
T Tolerance
)

Calculate distance from QueryPoint to segment (StartPt,EndPt)

FVector2< T ...

GetPointFromIndex

(
int i
)

bool

Intersects

(
const TSegment2< T >& OtherSegment,
T DotThresh,
T IntervalThresh
)

Test if this segment intersects with OtherSegment.

T

Length()

FVector2< T ...

NearestPoint

(
const FVector2< T >& QueryPoint
)

FVector2< T ...

PointAt

(
T DistanceParameter
)

FVector2< T ...

PointBetween

(
T UnitParameter
)

T

Project

(
const FVector2< T >& QueryPoint
)

T

ProjectUnitRange

(
const FVector2< T >& QueryPoint
)

void

Reverse()

Reverse the segment

void

SetEndPoint

(
const FVector2< T >& Point
)

Update the Segment with a new end point

void

SetStartPoint

(
const FVector2< T >& Point
)

Update the Segment with a new start point

FVector2< T ...

StartPoint()

void

update_from_endpoints

(
const FVector2< T >& p0,
const FVector2< T >& p1
)

Update segment based on new endpoints

int

WhichSide

(
const FVector2< T >& QueryPoint,
T Tolerance
)

Determine which side of the segment the query point lies on

int

WhichSide

(
const FVector2< T >& StartPt,
const FVector2< T >& EndPt,
const FVector2< T >& QueryPt,
T Tolerance
)

Determine which side of the segment the query point lies on

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.