Struct Circle
- Namespace
- SimulationFramework
- Assembly
- SimulationFramework.dll
A floating point 2-dimensional circle.
public struct Circle : IEquatable<Circle>
- Implements
- Inherited Members
Constructors
Circle(Vector2, float, Alignment)
Creates a new circle given its position and radius.
public Circle(Vector2 position, float radius, Alignment alignment = Alignment.Center)
Parameters
position
Vector2The position of the circle.
radius
floatThe radius of the circle.
alignment
AlignmentThe location of
position
on the circle's bounding box.
Circle(float, float, float, Alignment)
Creates a new circle given its position and radius.
public Circle(float x, float y, float radius, Alignment alignment = Alignment.Center)
Parameters
x
floatThe x position of the circle.
y
floatThe y position of the circle.
radius
floatThe radius of the circle.
alignment
AlignmentThe location of
x
andy
on the circle's bounding box.
Fields
Position
The position of the circle.
public Vector2 Position
Field Value
Radius
The radius of the circle.
public float Radius
Field Value
Unit
The unit circle at (0, 0).
public static readonly Circle Unit
Field Value
Methods
ContainsPoint(Vector2)
Determines if a point lies within this circle.
public bool ContainsPoint(Vector2 point)
Parameters
point
Vector2The point to check the circle for.
Returns
Distance(Circle)
Computes the distance from this circle to another.
public float Distance(Circle other)
Parameters
other
CircleThe circle to compute the distance to.
Returns
- float
The computed distance, or 0 if the point lies within this circle.
Distance(Vector2)
Computes the distance from this circle to a given point.
public float Distance(Vector2 point)
Parameters
point
Vector2The point to compute the distance to.
Returns
- float
The computed distance, or 0 if the point lies within this circle.
Equals(Circle)
Indicates if this circle is equal to another.
public bool Equals(Circle other)
Parameters
other
CircleThe circle to compare with this circle.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetBounds()
Computes the bounding rectangle of this circle.
public Rectangle GetBounds()
Returns
- Rectangle
The bounds of this circle.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
GetPoint(float)
Computes a point on this circle given an angle.
public Vector2 GetPoint(float angle)
Parameters
angle
float
Returns
- Vector2
The computed point.
Intersects(Circle)
Determines if two circles are intersecting.
public bool Intersects(Circle other)
Parameters
other
CircleThe circle to check for an intersection with.
Returns
SignedDistance(Circle)
Computes the signed distance from this circle to another.
public float SignedDistance(Circle other)
Parameters
other
CircleThe circle to compute the distance to.
Returns
- float
The computed distance.
SignedDistance(Vector2)
Computes the signed distance from this circle to a given point.
public float SignedDistance(Vector2 point)
Parameters
point
Vector2The point to compute the distance to.
Returns
- float
The computed distance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(Circle, Circle)
public static bool operator ==(Circle left, Circle right)
Parameters
Returns
operator !=(Circle, Circle)
public static bool operator !=(Circle left, Circle right)