Class Point2d
2-Dimensional point.
Namespace: Paramdigma.Core.Geometry
Assembly: Paramdigma.Core.dll
Syntax
public class Point2d : object
Constructors
| Improve this Doc View SourcePoint2d()
Initializes a new instance of the Point2d class.
Declaration
public Point2d()
Point2d(Point2d)
Initializes a new instance of the Point2d class from an existing point.
Declaration
public Point2d(Point2d pt)
Parameters
Type | Name | Description |
---|---|---|
Point2d | pt | A 2D point. |
Point2d(Double, Double)
Initializes a new instance of the Point2d class from x and y coordinates.
Declaration
public Point2d(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | X coordinate of the point. |
System.Double | y | Y coordinate of the point. |
Properties
| Improve this Doc View SourceOrigin
Gets a new 2d point with all coordinates =0.
Declaration
public static Point2d Origin { get; }
Property Value
Type | Description |
---|---|
Point2d | Origin 2d point. |
X
Gets or sets the X coordinate of the point.
Declaration
public double X { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Y
Gets or sets the Y coordinate of the point.
Declaration
public double Y { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceEquals(Object)
Compares a Point2d instance to the given objects.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if object is equals, false if not. |
GetHashCode()
Gets the hash code for the corresponding Point2d instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Returns an int representing the Point2d hash code. |
ToString()
String representation of a 2-dimensional point instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Returns string representation of this Point2d instance. |
Operators
| Improve this Doc View SourceAddition(Point2d, Point2d)
Add two points together.
Declaration
public static Vector2d operator +(Point2d point, Point2d point2)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | First point. |
Point2d | point2 | Second point. |
Returns
Type | Description |
---|---|
Vector2d | Addition result. |
Addition(Point2d, Vector2d)
Divides a point by a number.
Declaration
public static Point2d operator +(Point2d point, Vector2d v)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | Point. |
Vector2d | v | Vector. |
Returns
Type | Description |
---|---|
Point2d | Division result. |
Division(Point2d, Double)
Divides a point by a number.
Declaration
public static Point2d operator /(Point2d point, double scalar)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | Point. |
System.Double | scalar | Operand. |
Returns
Type | Description |
---|---|
Point2d | Division result. |
Equality(Point2d, Point2d)
Equality comparison between points.
Declaration
public static bool operator ==(Point2d point, Point2d point2)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | First point. |
Point2d | point2 | Second point. |
Returns
Type | Description |
---|---|
System.Boolean | True if equal. |
Explicit(Vector2d to Point2d)
Explicit conversion from 2-dimensional point to vector.
Declaration
public static explicit operator Point2d(Vector2d v)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | v | Vector to convert. |
Returns
Type | Description |
---|---|
Point2d |
Implicit(Point2d to Vector2d)
Implicit conversion from 2-dimensional point to vector.
Declaration
public static implicit operator Vector2d(Point2d pt)
Parameters
Type | Name | Description |
---|---|---|
Point2d | pt | Point to convert. |
Returns
Type | Description |
---|---|
Vector2d |
Inequality(Point2d, Point2d)
Inequality comparison between points.
Declaration
public static bool operator !=(Point2d point, Point2d point2)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | First point. |
Point2d | point2 | Second point. |
Returns
Type | Description |
---|---|
System.Boolean | True if NOT equal. |
Multiply(Point2d, Double)
Multiplies a point by a number.
Declaration
public static Point2d operator *(Point2d point, double scalar)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | Point to multiply. |
System.Double | scalar | Operand. |
Returns
Type | Description |
---|---|
Point2d | Multiplication result. |
Multiply(Double, Point2d)
Multiplies a point by a number.
Declaration
public static Point2d operator *(double scalar, Point2d point)
Parameters
Type | Name | Description |
---|---|---|
System.Double | scalar | Operand. |
Point2d | point | Point to multiply. |
Returns
Type | Description |
---|---|
Point2d | Multiplication result. |
Subtraction(Point2d, Point2d)
Substracts one point from another.
Declaration
public static Vector2d operator -(Point2d point, Point2d point2)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | First point. |
Point2d | point2 | Second point. |
Returns
Type | Description |
---|---|
Vector2d | Substraction result. |
UnaryNegation(Point2d)
Negates a given point.
Declaration
public static Point2d operator -(Point2d point)
Parameters
Type | Name | Description |
---|---|---|
Point2d | point | Point to negate. |
Returns
Type | Description |
---|---|
Point2d | Negation result. |