C# Class AForge.IntPoint

Structure for representing a pair of coordinates of integer type.

The structure is used to store a pair of integer coordinates.

Sample usage:

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

Public Properties

Property Type Description
X int
Y int

Public Methods

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

Addition operator - adds values of two points.

Add ( IntPoint point, int valueToAdd ) : IntPoint

Addition operator - adds scalar to the specified point.

DistanceTo ( IntPoint anotherPoint ) : float

Calculate Euclidean distance between two points.

Divide ( IntPoint point, int factor ) : IntPoint

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

Equals ( object obj ) : bool

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

EuclideanNorm ( ) : float

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.

IntPoint ( int x, int y ) : System

Initializes a new instance of the IntPoint structure.

Multiply ( IntPoint point, int factor ) : IntPoint

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

SquaredDistanceTo ( Point anotherPoint ) : float

Calculate squared Euclidean distance between two points.

Subtract ( IntPoint point1, IntPoint point2 ) : IntPoint

Subtraction operator - subtracts values of two points.

Subtract ( IntPoint point, int valueToSubtract ) : IntPoint

Subtraction operator - subtracts scalar from the specified point.

ToString ( ) : string

Get string representation of the class.

operator ( ) : IntPoint

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 ( IntPoint point1, IntPoint point2 ) : IntPoint
point1 IntPoint First point for addition.
point2 IntPoint Second point for addition.
return IntPoint

Add() public static method

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

DistanceTo() public method

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

Divide() public static method

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

Equals() public method

Check if this instance of IntPoint 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 ( ) : float
return float

GetHashCode() public method

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

IntPoint() public method

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

Multiply() public static method

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

SquaredDistanceTo() public method

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

Subtract() public static method

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

Subtract() public static method

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

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 ( ) : IntPoint
return IntPoint

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 int X
return int

Y public_oe property

Y coordinate.
public int Y
return int