Class Segment
Definition
- Assembly:
- Tizen.NUI.Physics2D.dll
A line segment shape between two points, which is mainly useful when it behaves statically, though it can be beveled to give it thickness.
public class Segment : Shape
- Inheritance
Constructors
View SourceSegment(Body, Vect, Vect, double)
Create a line segment.
Declaration
public Segment(Body body, Vect a, Vect b, double radius)
Parameters
Type | Name | Description |
---|---|---|
Body | body | The body to attach the segment to. |
Vect | a | The first endpoint of the segment. |
Vect | b | The second endpoint of the segment. |
double | radius | The thickness of the segment. |
Properties
View SourceA
Get the first endpoint of the segment shape.
Declaration
public Vect A { get; }
Property Value
Type | Description |
---|---|
Vect |
Area
Calculate the area of the segment, assuming a thickness has been provided. The area is calculated assuming the endpoints would be rounded, like a capsule.
Declaration
public double Area { get; }
Property Value
Type | Description |
---|---|
double |
B
Get the second endpoint of the segment shape.
Declaration
public Vect B { get; }
Property Value
Type | Description |
---|---|
Vect |
Normal
Get the normal of the segment shape.
Declaration
public Vect Normal { get; }
Property Value
Type | Description |
---|---|
Vect |
Radius
Get the segment radius.
Declaration
public double Radius { get; }
Property Value
Type | Description |
---|---|
double |
Methods
View SourceAreaForSegment(Vect, Vect, double)
Calculate the area of a segment, assuming a thickness has been provided. The area is calculated assuming the endpoints would be rounded, like a capsule.
Declaration
public static double AreaForSegment(Vect a, Vect b, double radius)
Parameters
Type | Name | Description |
---|---|---|
Vect | a | |
Vect | b | |
double | radius |
Returns
Type | Description |
---|---|
double |
MomentForMass(double)
Calculate the moment of inertia of the segment.
Declaration
public double MomentForMass(double mass)
Parameters
Type | Name | Description |
---|---|---|
double | mass |
Returns
Type | Description |
---|---|
double |
MomentForSegment(double, Vect, Vect, double)
Calculate the moment of inertia for the line segment.
Declaration
public static double MomentForSegment(double mass, Vect a, Vect b, double radius)
Parameters
Type | Name | Description |
---|---|---|
double | mass | |
Vect | a | |
Vect | b | |
double | radius |
Returns
Type | Description |
---|---|
double |
SetNeighbors(Vect, Vect)
Let Chipmunk know about the geometry of adjacent segments to avoid colliding with endcaps.
Declaration
public void SetNeighbors(Vect prev, Vect next)
Parameters
Type | Name | Description |
---|---|---|
Vect | prev | |
Vect | next |