Class LineSegment2DEx
Inheritance
System.Object
LineSegment2DEx
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: PLATEAU.Util.GeoGraph
Assembly: cs.temp.dll.dll
Syntax
public static class LineSegment2DEx
Methods
GetDistance(LineSegment2D, LineSegment2D)
線分間の距離を返す
Declaration
public static float GetDistance(this LineSegment2D self, LineSegment2D other)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
LineSegment2D | other |
Returns
Type | Description |
---|---|
System.Single |
GetNearestPoint(LineSegment2D, Vector2)
点vから線分に対して最も近い点を返す
Declaration
public static Vector2 GetNearestPoint(this LineSegment2D self, Vector2 v)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
Vector2 | v |
Returns
Type | Description |
---|---|
Vector2 |
GetNearestPoint(LineSegment2D, Vector2, out Single)
点vから線分に対して最も近い点を返す. distanceFromSegmentStartにはStartからの距離(符号あり)が入る
Declaration
public static Vector2 GetNearestPoint(this LineSegment2D self, Vector2 v, out float distanceFromSegmentStart)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
Vector2 | v | |
System.Single | distanceFromSegmentStart |
Returns
Type | Description |
---|---|
Vector2 |
GetNearestPoint(LineSegment2D, Vector2, out Single, out Single)
Declaration
public static Vector2 GetNearestPoint(this LineSegment2D self, Vector2 v, out float distanceFromSegmentStart, out float t)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
Vector2 | v | |
System.Single | distanceFromSegmentStart | |
System.Single | t |
Returns
Type | Description |
---|---|
Vector2 |
GetPoint(LineSegment2D, Single)
self.Start + distance * self.Direction
Declaration
public static Vector2 GetPoint(this LineSegment2D self, float distance)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
System.Single | distance |
Returns
Type | Description |
---|---|
Vector2 |
Reversed(LineSegment2D)
Start/End反転させたものを返す
Declaration
public static LineSegment2D Reversed(this LineSegment2D self)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self |
Returns
Type | Description |
---|---|
LineSegment2D |
Sign(LineSegment2D, RnExplicit<Vector2>)
selfに対して, vが右側にあるか左側にあるかを返す(z軸上から見たとき) 右側 : 1, 左側 : -1, 線上 : 0
Declaration
public static int Sign(this LineSegment2D self, RnExplicit<Vector2> v)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
RnExplicit<Vector2> | v |
Returns
Type | Description |
---|---|
System.Int32 |
TryHalfLineIntersection(LineSegment2D, Vector2, Vector2, out Vector2, out Single, out Single)
引数の半直線(origin,dir)との交点を返す
Declaration
public static bool TryHalfLineIntersection(this LineSegment2D self, Vector2 origin, Vector2 dir, out Vector2 intersection, out float halfLineOffset, out float selfT)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
Vector2 | origin | |
Vector2 | dir | |
Vector2 | intersection | |
System.Single | halfLineOffset | intersection = origin + dir * t2となるt2が入る |
System.Single | selfT | intersection = self.Lerp(t1)となるt1が入る |
Returns
Type | Description |
---|---|
System.Boolean |
TryLineIntersection(LineSegment2D, Vector2, Vector2, out Vector2, out Single, out Single)
直線(origin,dir)との交点を返す
Declaration
public static bool TryLineIntersection(this LineSegment2D self, Vector2 origin, Vector2 dir, out Vector2 intersection, out float lineLength, out float segmentT)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
Vector2 | origin | |
Vector2 | dir | |
Vector2 | intersection | |
System.Single | lineLength | intersection = line.origin + line.direction * lineLengthとなる値 |
System.Single | segmentT | intersection = Vector2.LerpUnClamped(p1, p2, segmentT)となる値 |
Returns
Type | Description |
---|---|
System.Boolean |
TrySegmentIntersection(LineSegment2D, LineSegment2D)
引数の線分otherとの交点を返す
Declaration
public static bool TrySegmentIntersection(this LineSegment2D self, LineSegment2D other)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
LineSegment2D | other |
Returns
Type | Description |
---|---|
System.Boolean |
TrySegmentIntersection(LineSegment2D, LineSegment2D, out Vector2)
引数の線分otherとの交点を返す
Declaration
public static bool TrySegmentIntersection(this LineSegment2D self, LineSegment2D other, out Vector2 intersection)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
LineSegment2D | other | |
Vector2 | intersection | 交点 |
Returns
Type | Description |
---|---|
System.Boolean |
TrySegmentIntersection(LineSegment2D, LineSegment2D, out Vector2, out Single, out Single)
引数の線分otherとの交点を返す
Declaration
public static bool TrySegmentIntersection(this LineSegment2D self, LineSegment2D other, out Vector2 intersection, out float selfT, out float otherT)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
LineSegment2D | other | |
Vector2 | intersection | 交点 |
System.Single | selfT | |
System.Single | otherT |
Returns
Type | Description |
---|---|
System.Boolean |
TrySegmentIntersection(LineSegment2D, Vector2, Vector2, out Vector2, out Single, out Single)
引数の線分(v0,v1)との交点を返す
Declaration
public static bool TrySegmentIntersection(this LineSegment2D self, Vector2 v0, Vector2 v1, out Vector2 intersection, out float selfT, out float otherT)
Parameters
Type | Name | Description |
---|---|---|
LineSegment2D | self | |
Vector2 | v0 | |
Vector2 | v1 | |
Vector2 | intersection | |
System.Single | selfT | intersection = Mathf.Lerp(self.Start, self.End, selfT)となる値 |
System.Single | otherT | intersection = Mathf.Lerp(v0, v1, otherT)となる値 |
Returns
Type | Description |
---|---|
System.Boolean |