C# Class FlatRedBall.Math.Geometry.Segment

Show file Open project: vchelaru/FlatRedBall Class Usage Examples

Public Properties

Property Type Description
Point1 Point
Point2 Point
ZeroLength Segment

Public Methods

Method Description
AsRay ( ) : Microsoft.Xna.Framework.Ray
ClosestPointTo ( Point point ) : Point
CollideAgainst ( Polygon polygon ) : bool
DistanceTo ( AxisAlignedRectangle rectangle ) : float
DistanceTo ( Microsoft.Xna.Framework.Circle circle ) : float
DistanceTo ( Point point ) : float
DistanceTo ( Point point, Segment &connectingSegment ) : float
DistanceTo ( Point point, Microsoft.Xna.Framework.Vector3 &connectingVector ) : float

Returns the distance to the argument point as well as the connectin Vector3 from the Point to this.

DistanceTo ( Polygon polygon ) : float
DistanceTo ( Segment otherSegment ) : float
DistanceTo ( Microsoft.Xna.Framework.Vector3 vector ) : float
DistanceTo ( double x, double y ) : float
DistanceToSquared ( Microsoft.Xna.Framework.Vector3 &vector, Segment &connectingSegment ) : float
GetLength ( ) : double

Returns the length of the segment.

GetLengthSquared ( ) : double
IntersectionPoint ( Segment &s2, Point &intersectionPoint ) : void

Returns the point where this segment intersects the argument segment.

Intersects ( Segment s2 ) : bool

Determines whether this segment intersects the argument segment.

Intersects ( Segment s2, Point &intersectionPoint ) : bool
IsClosestPointOnEndpoint ( Point &point ) : bool

Determines whether the closest point on the segment lies on one of the endpoints.

IsParallelAndTouching ( Segment s2, Point &intersectionPoint ) : bool
MoveBy ( float x, float y ) : void

Shifts the segment by moving both points by the argument x,y values.

Normalize ( ) : void

Sets the length of the segment to 1 unit by moving the 2nd point.

If the segment has 0 length (the endpoints are equal), the method does not change the segment; length will remain 0.

ScaleBy ( float amountToScaleBy ) : void
Segment ( Microsoft.Xna.Framework.Graphics.VertexPositionColor &point1, Microsoft.Xna.Framework.Graphics.VertexPositionColor &point2 ) : System
Segment ( Point point1, Point point2 ) : System

Creates a new Segment with the argument points as the endpoints.

Segment ( Microsoft.Xna.Framework.Vector3 point1, Microsoft.Xna.Framework.Vector3 point2 ) : System
Segment ( double point1X, double point1Y, double point2X, double point2Y ) : System
SetPoints ( Microsoft.Xna.Framework.Graphics.VertexPositionColor &point1, Microsoft.Xna.Framework.Graphics.VertexPositionColor &point2 ) : void
SetPoints ( float x1, float y1, float x2, float y2 ) : void
ToString ( ) : string
ToVector3 ( ) : Microsoft.Xna.Framework.Vector3

Method Details

AsRay() public method

public AsRay ( ) : Microsoft.Xna.Framework.Ray
return Microsoft.Xna.Framework.Ray

ClosestPointTo() public method

public ClosestPointTo ( Point point ) : Point
point Point
return Point

CollideAgainst() public method

public CollideAgainst ( Polygon polygon ) : bool
polygon Polygon
return bool

DistanceTo() public method

public DistanceTo ( AxisAlignedRectangle rectangle ) : float
rectangle AxisAlignedRectangle
return float

DistanceTo() public method

public DistanceTo ( Microsoft.Xna.Framework.Circle circle ) : float
circle Microsoft.Xna.Framework.Circle
return float

DistanceTo() public method

public DistanceTo ( Point point ) : float
point Point
return float

DistanceTo() public method

public DistanceTo ( Point point, Segment &connectingSegment ) : float
point Point
connectingSegment Segment
return float

DistanceTo() public method

Returns the distance to the argument point as well as the connectin Vector3 from the Point to this.
public DistanceTo ( Point point, Microsoft.Xna.Framework.Vector3 &connectingVector ) : float
point Point The point to get the distance to.
connectingVector Microsoft.Xna.Framework.Vector3 The connecting vector from the argument Pointn to this.
return float

DistanceTo() public method

public DistanceTo ( Polygon polygon ) : float
polygon Polygon
return float

DistanceTo() public method

public DistanceTo ( Segment otherSegment ) : float
otherSegment Segment
return float

DistanceTo() public method

public DistanceTo ( Microsoft.Xna.Framework.Vector3 vector ) : float
vector Microsoft.Xna.Framework.Vector3
return float

DistanceTo() public method

public DistanceTo ( double x, double y ) : float
x double
y double
return float

DistanceToSquared() public method

public DistanceToSquared ( Microsoft.Xna.Framework.Vector3 &vector, Segment &connectingSegment ) : float
vector Microsoft.Xna.Framework.Vector3
connectingSegment Segment
return float

GetLength() public method

Returns the length of the segment.
public GetLength ( ) : double
return double

GetLengthSquared() public method

public GetLengthSquared ( ) : double
return double

IntersectionPoint() public method

Returns the point where this segment intersects the argument segment.
public IntersectionPoint ( Segment &s2, Point &intersectionPoint ) : void
s2 Segment The segment to test for intersection.
intersectionPoint Point
return void

Intersects() public method

Determines whether this segment intersects the argument segment.
public Intersects ( Segment s2 ) : bool
s2 Segment The segment to test for intersection.
return bool

Intersects() public method

public Intersects ( Segment s2, Point &intersectionPoint ) : bool
s2 Segment
intersectionPoint Point
return bool

IsClosestPointOnEndpoint() public method

Determines whether the closest point on the segment lies on one of the endpoints.
public IsClosestPointOnEndpoint ( Point &point ) : bool
point Point The point to test to.
return bool

IsParallelAndTouching() public method

public IsParallelAndTouching ( Segment s2, Point &intersectionPoint ) : bool
s2 Segment
intersectionPoint Point
return bool

MoveBy() public method

Shifts the segment by moving both points by the argument x,y values.
public MoveBy ( float x, float y ) : void
x float The number of units to shift the segment by on the x axis.
y float The number of units to shift the segment by on the y axis.
return void

Normalize() public method

Sets the length of the segment to 1 unit by moving the 2nd point.
If the segment has 0 length (the endpoints are equal), the method does not change the segment; length will remain 0.
public Normalize ( ) : void
return void

ScaleBy() public method

public ScaleBy ( float amountToScaleBy ) : void
amountToScaleBy float
return void

Segment() public method

public Segment ( Microsoft.Xna.Framework.Graphics.VertexPositionColor &point1, Microsoft.Xna.Framework.Graphics.VertexPositionColor &point2 ) : System
point1 Microsoft.Xna.Framework.Graphics.VertexPositionColor
point2 Microsoft.Xna.Framework.Graphics.VertexPositionColor
return System

Segment() public method

Creates a new Segment with the argument points as the endpoints.
public Segment ( Point point1, Point point2 ) : System
point1 Point The first Point.
point2 Point The second Point.
return System

Segment() public method

public Segment ( Microsoft.Xna.Framework.Vector3 point1, Microsoft.Xna.Framework.Vector3 point2 ) : System
point1 Microsoft.Xna.Framework.Vector3
point2 Microsoft.Xna.Framework.Vector3
return System

Segment() public method

public Segment ( double point1X, double point1Y, double point2X, double point2Y ) : System
point1X double
point1Y double
point2X double
point2Y double
return System

SetPoints() public method

public SetPoints ( Microsoft.Xna.Framework.Graphics.VertexPositionColor &point1, Microsoft.Xna.Framework.Graphics.VertexPositionColor &point2 ) : void
point1 Microsoft.Xna.Framework.Graphics.VertexPositionColor
point2 Microsoft.Xna.Framework.Graphics.VertexPositionColor
return void

SetPoints() public method

public SetPoints ( float x1, float y1, float x2, float y2 ) : void
x1 float
y1 float
x2 float
y2 float
return void

ToString() public method

public ToString ( ) : string
return string

ToVector3() public method

public ToVector3 ( ) : Microsoft.Xna.Framework.Vector3
return Microsoft.Xna.Framework.Vector3

Property Details

Point1 public property

The first point of the segment.
public Point Point1
return Point

Point2 public property

The second point of the segment.
public Point Point2
return Point

ZeroLength public static property

public static Segment,FlatRedBall.Math.Geometry ZeroLength
return Segment