Remarks: The point struct is used for drawing and positioning of elements and widgets
Constructors
Point
#Initializes a new instance of a Point class with truncated values of the specified floating-point
pointParameters:
| point (PointF) | PointF to initialize the X and Y values of the new instance with |
Point
#Initializes a new instance of a Point class with X and Y values corresponding to the Size.Width and Size.Height values of the specified
size, respecitivelyParameters:
| size (Size) | Size to initialize the X and Y values of the new instance with |
Fields
Properties
Length
#Gets the length of the point as a vector from origin 0,0
Value: The length of this point as a vector
LengthSquared
#Gets the squared length of the point as a vector from origin 0,0.
Value: The length of the squared.
Normal
#Gets the point as a normal vector (perpendicular) to the current point from the origin
Value: The normal vector of this point
UnitVector
#Gets the current point as a unit vector (a point with a Length of 1.0 from origin 0,0)
Value: The unit vector equivalent of this point's X and Y coordinates
Methods
Abs
#Returns the absolute X and Y components of the specified
pointParameters:
| point (Point) | Point with positive or negative X and/or Y values |
Returns: A new point with absolute (positive) X and Y values of the specified
pointDistance
#Gets the distance between this point and the specified
pointParameters:
| point (Point) | Point to calculate the distance from |
Distance
#Gets the distance between two points using pythagoras theorem
DotProduct
#Gets the dot product of this instance and the specified
pointParameters:
| point (Point) | Point to get the dot product for |
Returns: The dot product (X * point.X + Y * point.Y) between this point and the specified point
DotProduct
#Gets the dot product between two points
Equals
#Returns a value indicating that the specified
obj is equal to this pointParameters:
| obj (object) | Object to compare |
Returns: True if the specified
obj is a Point and is equal to this instance, false otherwiseOverrides: ValueType.Equals
Equals
#Returns a value indicating that the specified
other point is equal to this pointParameters:
| other (Point) | Other point to compare |
Returns: True if the other point is equal to this point, otherwise false
GetHashCode
#Gets the hash code of this point
Returns: Hash code for this point
Overrides: ValueType.GetHashCode
Max
#Returns the maximum X and Y components of two points
Returns: A new point with the maximum X and Y values of the two points
Min
#Returns the minimum X and Y components of two points
Returns: A new point with the minimum X and Y values of the two points
Offset
#Offsets the X and Y co-ordinates of the
point by the specified x and y valuesOffset
#Offsets the X and Y co-ordinates of the
point by the values from the specified offsetReturns: A new point offset by the specified value
Offset
#Offsets the X and Y co-ordinates of this point by the specified
x and y valuesOffset
#Offsets the X and Y co-ordinates of this point by the values from the specified
pointParameters:
| point (Point) | Point with X and Y values to add to this point |
Restrict
#Restricts the X and Y co-ordinates of the specified
point within the rectangleRestrict
#Restricts the X and Y co-ordinates within the specified
rectangleRemarks: This will update the X and Y co-ordinates to be within the specified
rectangle's bounds. The updated co-ordinates will be the closest to the original value as possible. E.g. if the X co-ordinate is greater than the Rectangle.Right of the rectangle, it will be set to be Rectangle.Right minus one, to be within the rectangle's bounds.Parameters:
| rectangle (Rectangle) | Rectangle to restrict the X and Y co-ordinates in |
Round
#Rounds the X and Y components of the specified
point to a PointParameters:
| point (PointF) | Floating point value to round |
Returns: A new instance of a Point with rounded X and Y values of the specified
pointToString
#Converts this point to a string
Returns: String representation of this point
Overrides: ValueType.ToString
Truncate
#Truncates the X and Y components of the specified
point to a PointParameters:
| point (PointF) | Floating point value to truncate |
Returns: A new instance of a Point with truncated X and Y values of the specified
pointOperators
| Operation | Result | Description | ||
|---|---|---|---|---|
| Point | + | int | Point | Operator to add a value to both the X and Y co-ordinates of a point |
| Point | + | Size | Point | Operator to add a size to a point |
| Point | + | Point | Point | Operator to return the addition of two points as a Point |
| Point | / | int | Point | Divides the X and Y co-ordinates of the specified point with a given value |
| Point | / | Size | Point | Divides the specified point with a size |
| Point | == | Point | bool | Determines equality between two points |
| Point | != | Point | bool | Determines the inequality between two points |
| int | * | Point | Point | Multiplies the X and Y co-ordinates of the specified point with a given factor |
| Point | * | int | Point | Multiplies the X and Y co-ordinates of the specified point with a given factor |
| Point | * | Size | Point | Multiplies the specified point with a size |
| Point | * | Point | Point | Multiplies the X and Y co-ordinates of the two specified point values |
| Point | * | float | PointF | Multiplies the X and Y of a point by the specified floating point factor |
| Point | - | int | Point | Operator to subtract a value from both the X and Y co-ordinates of a point |
| Point | - | Size | Point | Operator to subtract a size from a point |
| Point | - | Point | Point | Operator to return the difference between two points as a Size |
| - | Point | Point | Returns a new Point with negative x and y values of the specified point | |