PINE LIBRARY
Segment2

Library "Segment2"
Structure representation of a directed straight line in two dimensions from origin to target vectors.
.
reference:
graphics.stanford.edu/courses/cs368/CGAL/ref-manual1/CGAL_Segment_2.html
.
new(origin, target)
Generate a new segment.
Parameters:
origin: Vector2 . Origin of the segment.
target: Vector2 . Target of the segment.
Returns: Segment2.
new(origin_x, origin_y, target_x, target_y)
Generate a new segment.
Parameters:
origin_x: float . Origin of the segment x coordinate.
origin_y: float . Origin of the segment y coordinate.
target_x: float . Target of the segment x coordinate.
target_y: float . Target of the segment y coordinate.
Returns: Segment2.
copy(this)
Copy a segment.
Parameters:
this: Vector2 . Segment to copy.
Returns: Segment2.
length_squared(this)
Squared length of the normalized segment vector. For comparing vectors this is computationaly lighter.
Parameters:
this: Segment2 . Sorce segment.
Returns: float.
length(this)
Length of the normalized segment vector.
Parameters:
this: Segment2 . Sorce segment.
Returns: float.
opposite(this)
Reverse the direction of the segment.
Parameters:
this: Segment2 . Source segment.
Returns: Segment2.
is_degenerate(this)
Segment is degenerate when origin and target are equal.
Parameters:
this: Segment2 . Source segment.
Returns: bool.
is_horizontal(this)
Segment is horizontal?.
Parameters:
this: Segment2 . Source segment.
Returns: bool.
is_horizontal(this, precision)
Segment is horizontal?.
Parameters:
this: Segment2 . Source segment.
precision: float . Limit of precision.
Returns: bool.
is_vertical(this)
Segment is vertical?.
Parameters:
this: Segment2 . Source segment.
Returns: bool.
is_vertical(this, precision)
Segment is vertical?.
Parameters:
this: Segment2 . Source segment.
precision: float . Limit of precision.
Returns: bool.
equals(this, other)
Tests two segments for equality (share same origin and target).
Parameters:
this: Segment2 . Source segment.
other: Segment2 . Target segment.
Returns: bool.
nearest_to_point(this, point)
Find the nearest point in a segment to another point.
Parameters:
this: Segment2 . Source segment.
point: Vector2 . Point to aproximate.
Returns: Vector2.
intersection(this, other)
Find the intersection vector of 2 lines.
Parameters:
this: Segment2 . Segment A.
other: Segment2 . Segment B.
Returns: Vector2.Vector2 Object.
extend(this, at_origin, at_target)
Extend a segment by the percent ratio provided.
Parameters:
this: Segment2 . Source segment.
at_origin: float . Percent ratio to extend at origin vector.
at_target: float . Percent ratio to extend at target vector.
Returns: Segment2.
to_string(this)
Translate segment to string format `( (x,y), (x,y) )`.
Parameters:
this: Segment2 . Source segment.
Returns: string.
to_string(this, format)
Translate segment to string format `((x,y), (x,y))`.
Parameters:
this: Segment2 . Source segment.
format: string . Format string to apply.
Returns: string.
to_array(this)
Translate segment to array format.
Parameters:
this: Segment2 . Source segment.
Returns: array<float>.
Structure representation of a directed straight line in two dimensions from origin to target vectors.
.
reference:
graphics.stanford.edu/courses/cs368/CGAL/ref-manual1/CGAL_Segment_2.html
.
new(origin, target)
Generate a new segment.
Parameters:
origin: Vector2 . Origin of the segment.
target: Vector2 . Target of the segment.
Returns: Segment2.
new(origin_x, origin_y, target_x, target_y)
Generate a new segment.
Parameters:
origin_x: float . Origin of the segment x coordinate.
origin_y: float . Origin of the segment y coordinate.
target_x: float . Target of the segment x coordinate.
target_y: float . Target of the segment y coordinate.
Returns: Segment2.
copy(this)
Copy a segment.
Parameters:
this: Vector2 . Segment to copy.
Returns: Segment2.
length_squared(this)
Squared length of the normalized segment vector. For comparing vectors this is computationaly lighter.
Parameters:
this: Segment2 . Sorce segment.
Returns: float.
length(this)
Length of the normalized segment vector.
Parameters:
this: Segment2 . Sorce segment.
Returns: float.
opposite(this)
Reverse the direction of the segment.
Parameters:
this: Segment2 . Source segment.
Returns: Segment2.
is_degenerate(this)
Segment is degenerate when origin and target are equal.
Parameters:
this: Segment2 . Source segment.
Returns: bool.
is_horizontal(this)
Segment is horizontal?.
Parameters:
this: Segment2 . Source segment.
Returns: bool.
is_horizontal(this, precision)
Segment is horizontal?.
Parameters:
this: Segment2 . Source segment.
precision: float . Limit of precision.
Returns: bool.
is_vertical(this)
Segment is vertical?.
Parameters:
this: Segment2 . Source segment.
Returns: bool.
is_vertical(this, precision)
Segment is vertical?.
Parameters:
this: Segment2 . Source segment.
precision: float . Limit of precision.
Returns: bool.
equals(this, other)
Tests two segments for equality (share same origin and target).
Parameters:
this: Segment2 . Source segment.
other: Segment2 . Target segment.
Returns: bool.
nearest_to_point(this, point)
Find the nearest point in a segment to another point.
Parameters:
this: Segment2 . Source segment.
point: Vector2 . Point to aproximate.
Returns: Vector2.
intersection(this, other)
Find the intersection vector of 2 lines.
Parameters:
this: Segment2 . Segment A.
other: Segment2 . Segment B.
Returns: Vector2.Vector2 Object.
extend(this, at_origin, at_target)
Extend a segment by the percent ratio provided.
Parameters:
this: Segment2 . Source segment.
at_origin: float . Percent ratio to extend at origin vector.
at_target: float . Percent ratio to extend at target vector.
Returns: Segment2.
to_string(this)
Translate segment to string format `( (x,y), (x,y) )`.
Parameters:
this: Segment2 . Source segment.
Returns: string.
to_string(this, format)
Translate segment to string format `((x,y), (x,y))`.
Parameters:
this: Segment2 . Source segment.
format: string . Format string to apply.
Returns: string.
to_array(this)
Translate segment to array format.
Parameters:
this: Segment2 . Source segment.
Returns: array<float>.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.