C# Class FarseerPhysics.Common.PolygonTools

Show file Open project: prime31/Nez

Public Methods

Method Description
createArc ( float radians, int sides, float radius ) : Vertices
createCapsule ( float height, float endRadius, int edges ) : Vertices

Creates an capsule with the specified height, radius and number of edges. A capsule has the same form as a pill capsule.

createCapsule ( float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges ) : Vertices

Creates an capsule with the specified height, radius and number of edges. A capsule has the same form as a pill capsule.

createCircle ( float radius, int numberOfEdges ) : Vertices

Creates a circle with the specified radius and number of edges.

createEllipse ( float xRadius, float yRadius, int numberOfEdges ) : Vertices

Creates a ellipse with the specified width, height and number of edges.

createGear ( float radius, int numberOfTeeth, float tipPercentage, float toothHeight ) : Vertices

Creates a gear shape with the specified radius and number of teeth.

createLine ( Vector2 start, Vector2 end ) : Vertices

Set this as a single edge.

createPolygonFromTextureData ( uint data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection ) : List

Detects the vertices by analyzing the texture data.

createPolygonFromTextureData ( Nez subtexture ) : Vertices
createPolygonFromTextureData ( Texture2D texture ) : Vertices
createPolygonFromTextureData ( uint data, int width ) : Vertices

Detects the vertices by analyzing the texture data.

createPolygonFromTextureData ( uint data, int width, bool holeDetection ) : Vertices

Detects the vertices by analyzing the texture data.

createRectangle ( float hx, float hy ) : Vertices

Build vertices to represent an axis-aligned box.

createRectangle ( float hx, float hy, Vector2 center, float angle ) : Vertices

Build vertices to represent an oriented box.

createRoundedRectangle ( float width, float height, float xRadius, float yRadius, int segments ) : Vertices

Creates a rounded rectangle with the specified width and height.

Method Details

createArc() public static method

public static createArc ( float radians, int sides, float radius ) : Vertices
radians float
sides int
radius float
return Vertices

createCapsule() public static method

Creates an capsule with the specified height, radius and number of edges. A capsule has the same form as a pill capsule.
public static createCapsule ( float height, float endRadius, int edges ) : Vertices
height float Height (inner height + 2 * radius) of the capsule.
endRadius float Radius of the capsule ends.
edges int The number of edges of the capsule ends. The more edges, the more it resembles an capsule
return Vertices

createCapsule() public static method

Creates an capsule with the specified height, radius and number of edges. A capsule has the same form as a pill capsule.
public static createCapsule ( float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges ) : Vertices
height float Height (inner height + radii) of the capsule.
topRadius float Radius of the top.
topEdges int The number of edges of the top. The more edges, the more it resembles an capsule
bottomRadius float Radius of bottom.
bottomEdges int The number of edges of the bottom. The more edges, the more it resembles an capsule
return Vertices

createCircle() public static method

Creates a circle with the specified radius and number of edges.
public static createCircle ( float radius, int numberOfEdges ) : Vertices
radius float The radius.
numberOfEdges int The number of edges. The more edges, the more it resembles a circle
return Vertices

createEllipse() public static method

Creates a ellipse with the specified width, height and number of edges.
public static createEllipse ( float xRadius, float yRadius, int numberOfEdges ) : Vertices
xRadius float Width of the ellipse.
yRadius float Height of the ellipse.
numberOfEdges int The number of edges. The more edges, the more it resembles an ellipse
return Vertices

createGear() public static method

Creates a gear shape with the specified radius and number of teeth.
public static createGear ( float radius, int numberOfTeeth, float tipPercentage, float toothHeight ) : Vertices
radius float The radius.
numberOfTeeth int The number of teeth.
tipPercentage float The tip percentage.
toothHeight float Height of the tooth.
return Vertices

createLine() public static method

Set this as a single edge.
public static createLine ( Vector2 start, Vector2 end ) : Vertices
start Vector2 The first point.
end Vector2 The second point.
return Vertices

createPolygonFromTextureData() public static method

Detects the vertices by analyzing the texture data.
public static createPolygonFromTextureData ( uint data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection ) : List
data uint The texture data.
width int The texture width.
hullTolerance float The hull tolerance.
alphaTolerance byte The alpha tolerance.
multiPartDetection bool if set to true it will perform multi part detection.
holeDetection bool if set to true it will perform hole detection.
return List

createPolygonFromTextureData() public static method

public static createPolygonFromTextureData ( Nez subtexture ) : Vertices
subtexture Nez
return Vertices

createPolygonFromTextureData() public static method

public static createPolygonFromTextureData ( Texture2D texture ) : Vertices
texture Texture2D
return Vertices

createPolygonFromTextureData() public static method

Detects the vertices by analyzing the texture data.
public static createPolygonFromTextureData ( uint data, int width ) : Vertices
data uint The texture data.
width int The texture width.
return Vertices

createPolygonFromTextureData() public static method

Detects the vertices by analyzing the texture data.
public static createPolygonFromTextureData ( uint data, int width, bool holeDetection ) : Vertices
data uint The texture data.
width int The texture width.
holeDetection bool if set to true it will perform hole detection.
return Vertices

createRectangle() public static method

Build vertices to represent an axis-aligned box.
public static createRectangle ( float hx, float hy ) : Vertices
hx float the half-width.
hy float the half-height.
return Vertices

createRectangle() public static method

Build vertices to represent an oriented box.
public static createRectangle ( float hx, float hy, Vector2 center, float angle ) : Vertices
hx float the half-width.
hy float the half-height.
center Vector2 the center of the box in local coordinates.
angle float the rotation of the box in local coordinates.
return Vertices

createRoundedRectangle() public static method

Creates a rounded rectangle with the specified width and height.
public static createRoundedRectangle ( float width, float height, float xRadius, float yRadius, int segments ) : Vertices
width float The width.
height float The height.
xRadius float The rounding X radius.
yRadius float The rounding Y radius.
segments int The number of segments to subdivide the edges.
return Vertices