C# Class AForge.DoublePoint

Structure for representing a pair of coordinates of double type.

The structure is used to store a pair of floating point coordinates with double precision.

Sample usage:

// assigning coordinates in the constructor DoublePoint p1 = new DoublePoint( 10, 20 ); // creating a point and assigning coordinates later DoublePoint p2; p2.X = 30; p2.Y = 40; // calculating distance between two points double distance = p1.DistanceTo( p2 );
Mostra file Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Properties

Property Type Description
X double
Y double

Public Methods

Method Description
Add ( DoublePoint point1, DoublePoint point2 ) : DoublePoint

Addition operator - adds values of two points.

Add ( DoublePoint point, double valueToAdd ) : DoublePoint

Addition operator - adds scalar to the specified point.

DistanceTo ( DoublePoint anotherPoint ) : double

Calculate Euclidean distance between two points.

Divide ( DoublePoint point, double factor ) : DoublePoint

Division operator - divides coordinates of the specified point by scalar value.

DoublePoint ( double x, double y ) : System

Initializes a new instance of the DoublePoint structure.

Equals ( object obj ) : bool

Check if this instance of DoublePoint equal to the specified one.

EuclideanNorm ( ) : double

Calculate Euclidean norm of the vector comprised of the point's coordinates - distance from (0, 0) in other words.

GetHashCode ( ) : int

Get hash code for this instance.

Multiply ( DoublePoint point, double factor ) : DoublePoint

Multiplication operator - multiplies coordinates of the specified point by scalar value.

Round ( ) : IntPoint

Rounds the double precision point.

SquaredDistanceTo ( DoublePoint anotherPoint ) : double

Calculate squared Euclidean distance between two points.

Subtract ( DoublePoint point1, DoublePoint point2 ) : DoublePoint

Subtraction operator - subtracts values of two points.

Subtract ( DoublePoint point, double valueToSubtract ) : DoublePoint

Subtraction operator - subtracts scalar from the specified point.

ToString ( ) : string

Get string representation of the class.

operator ( ) : DoublePoint

Addition operator - adds values of two points.

operator ( ) : bool

Equality operator - checks if two points have equal coordinates.

Method Details

Add() public static method

Addition operator - adds values of two points.
public static Add ( DoublePoint point1, DoublePoint point2 ) : DoublePoint
point1 DoublePoint First point for addition.
point2 DoublePoint Second point for addition.
return DoublePoint

Add() public static method

Addition operator - adds scalar to the specified point.
public static Add ( DoublePoint point, double valueToAdd ) : DoublePoint
point DoublePoint Point to increase coordinates of.
valueToAdd double Value to add to coordinates of the specified point.
return DoublePoint

DistanceTo() public method

Calculate Euclidean distance between two points.
public DistanceTo ( DoublePoint anotherPoint ) : double
anotherPoint DoublePoint Point to calculate distance to.
return double

Divide() public static method

Division operator - divides coordinates of the specified point by scalar value.
public static Divide ( DoublePoint point, double factor ) : DoublePoint
point DoublePoint Point to divide coordinates of.
factor double Division factor.
return DoublePoint

DoublePoint() public method

Initializes a new instance of the DoublePoint structure.
public DoublePoint ( double x, double y ) : System
x double X axis coordinate.
y double Y axis coordinate.
return System

Equals() public method

Check if this instance of DoublePoint equal to the specified one.
public Equals ( object obj ) : bool
obj object Another point to check equalty to.
return bool

EuclideanNorm() public method

Calculate Euclidean norm of the vector comprised of the point's coordinates - distance from (0, 0) in other words.
public EuclideanNorm ( ) : double
return double

GetHashCode() public method

Get hash code for this instance.
public GetHashCode ( ) : int
return int

Multiply() public static method

Multiplication operator - multiplies coordinates of the specified point by scalar value.
public static Multiply ( DoublePoint point, double factor ) : DoublePoint
point DoublePoint Point to multiply coordinates of.
factor double Multiplication factor.
return DoublePoint

Round() public method

Rounds the double precision point.
public Round ( ) : IntPoint
return IntPoint

SquaredDistanceTo() public method

Calculate squared Euclidean distance between two points.
public SquaredDistanceTo ( DoublePoint anotherPoint ) : double
anotherPoint DoublePoint Point to calculate distance to.
return double

Subtract() public static method

Subtraction operator - subtracts values of two points.
public static Subtract ( DoublePoint point1, DoublePoint point2 ) : DoublePoint
point1 DoublePoint Point to subtract from.
point2 DoublePoint Point to subtract.
return DoublePoint

Subtract() public static method

Subtraction operator - subtracts scalar from the specified point.
public static Subtract ( DoublePoint point, double valueToSubtract ) : DoublePoint
point DoublePoint Point to decrease coordinates of.
valueToSubtract double Value to subtract from coordinates of the specified point.
return DoublePoint

ToString() public method

Get string representation of the class.
public ToString ( ) : string
return string

operator() public static method

Addition operator - adds values of two points.
public static operator ( ) : DoublePoint
return DoublePoint

operator() public static method

Equality operator - checks if two points have equal coordinates.
public static operator ( ) : bool
return bool

Property Details

X public_oe property

X coordinate.
public double X
return double

Y public_oe property

Y coordinate.
public double Y
return double