構造体 ConvexPoly2

A convex polygon class in 2D. [詳細]

ConvexPoly2に対する継承グラフ
ICollisionBasics

すべてのメンバ一覧

Public メソッド

 ConvexPoly2 (Vector2[] points)
 ConvexPoly2 constructor.
void MakeBox (Bounds2 bounds)
void MakeRegular (uint num, float r)
uint Size ()
 Return the number of vertices (or faces)
Vector2 GetPoint (int index)
 Get a vertex position.
Vector2 GetNormal (int index)
 Get the normal vector of a face of this poly.
Plane2 GetPlane (int index)
 Get the plane formed by a face of this poly.
Bounds2 CalcBounds ()
 Calculate the bounds of this poly.
Vector2 CalcCenter ()
 Calculate the gravity center of this poly.
float CalcArea ()
 Calculate the area of this convex poly.
bool IsInside (Vector2 point)
 Return true if 'point' is inside the primitive (in its negative space).
void ClosestSurfacePoint (Vector2 point, out Vector2 ret, out float sign)
 Return the closest point to 'point' that lies on the surface of the primitive.
float SignedDistance (Vector2 point)
 Return the signed distance (penetration distance) from 'point' to the surface of the primitive.
void Translate (Vector2 dx, ConvexPoly2 poly)
bool NegativeClipSegment (ref Vector2 A, ref Vector2 B)
 Assuming the primitive is convex, clip the segment AB against the primitive.

Public 変数

Plane2[] Planes
 The convex poly is stored as a list of planes assumed to define a convex region.

プロパティ

Sphere2 Sphere [get]
 Bounding sphere, centered at center of mass.

説明

A convex polygon class in 2D.


コンストラクタとデストラクタ

ConvexPoly2 ( Vector2[]  points)

ConvexPoly2 constructor.

Assumes input points define a convex region.


メソッド

void ClosestSurfacePoint ( Vector2  point,
out Vector2  ret,
out float  sign 
)

Return the closest point to 'point' that lies on the surface of the primitive.

If that point is inside the primitive, sign is negative.

ICollisionBasicsを実装しています。

Vector2 GetNormal ( int  index)

Get the normal vector of a face of this poly.

引数:
indexThe face index.
Plane2 GetPlane ( int  index)

Get the plane formed by a face of this poly.

引数:
indexThe face index.
Vector2 GetPoint ( int  index)

Get a vertex position.

引数:
indexThe vertex index.
void MakeBox ( Bounds2  bounds)
void MakeRegular ( uint  num,
float  r 
)
bool NegativeClipSegment ( ref Vector2  A,
ref Vector2  B 
)

Assuming the primitive is convex, clip the segment AB against the primitive.

Return false if AB is entirely in positive halfspace, else clip against negative space and return true.

ICollisionBasicsを実装しています。

void Translate ( Vector2  dx,
ConvexPoly2  poly 
)

変数

The convex poly is stored as a list of planes assumed to define a convex region.

Plane base points are also polygon vertices.