C# Класс AForge.Point

Structure for representing a pair of coordinates of float type.

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

Sample usage:

// assigning coordinates in the constructor Point p1 = new Point( 10, 20 ); // creating a point and assigning coordinates later Point p2; p2.X = 30; p2.Y = 40; // calculating distance between two points float distance = p1.DistanceTo( p2 );
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
X float
Y float

Открытые методы

Метод Описание
Add ( Point point1, Point point2 ) : Point

Addition operator - adds values of two points.

Add ( Point point, float valueToAdd ) : Point

Addition operator - adds scalar to the specified point.

DistanceTo ( Point anotherPoint ) : float

Calculate Euclidean distance between two points.

Divide ( Point point, float factor ) : Point

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

Equals ( object obj ) : bool

Check if this instance of Point 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.

Multiply ( Point point, float factor ) : Point

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

Point ( float x, float y ) : System

Initializes a new instance of the Point structure.

Round ( ) : IntPoint

Rounds the single precision point.

SquaredDistanceTo ( Point anotherPoint ) : float

Calculate squared Euclidean distance between two points.

Subtract ( Point point1, Point point2 ) : Point

Subtraction operator - subtracts values of two points.

Subtract ( Point point, float valueToSubtract ) : Point

Subtraction operator - subtracts scalar from the specified point.

ToString ( ) : string

Get string representation of the class.

operator ( ) : Point

Addition operator - adds values of two points.

operator ( ) : bool

Equality operator - checks if two points have equal coordinates.

Описание методов

Add() публичный статический Метод

Addition operator - adds values of two points.
public static Add ( Point point1, Point point2 ) : Point
point1 Point First point for addition.
point2 Point Second point for addition.
Результат Point

Add() публичный статический Метод

Addition operator - adds scalar to the specified point.
public static Add ( Point point, float valueToAdd ) : Point
point Point Point to increase coordinates of.
valueToAdd float Value to add to coordinates of the specified point.
Результат Point

DistanceTo() публичный Метод

Calculate Euclidean distance between two points.
public DistanceTo ( Point anotherPoint ) : float
anotherPoint Point Point to calculate distance to.
Результат float

Divide() публичный статический Метод

Division operator - divides coordinates of the specified point by scalar value.
public static Divide ( Point point, float factor ) : Point
point Point Point to divide coordinates of.
factor float Division factor.
Результат Point

Equals() публичный Метод

Check if this instance of Point equal to the specified one.
public Equals ( object obj ) : bool
obj object Another point to check equalty to.
Результат bool

EuclideanNorm() публичный Метод

Calculate Euclidean norm of the vector comprised of the point's coordinates - distance from (0, 0) in other words.
public EuclideanNorm ( ) : float
Результат float

GetHashCode() публичный Метод

Get hash code for this instance.
public GetHashCode ( ) : int
Результат int

Multiply() публичный статический Метод

Multiplication operator - multiplies coordinates of the specified point by scalar value.
public static Multiply ( Point point, float factor ) : Point
point Point Point to multiply coordinates of.
factor float Multiplication factor.
Результат Point

Point() публичный Метод

Initializes a new instance of the Point structure.
public Point ( float x, float y ) : System
x float X axis coordinate.
y float Y axis coordinate.
Результат System

Round() публичный Метод

Rounds the single precision point.
public Round ( ) : IntPoint
Результат IntPoint

SquaredDistanceTo() публичный Метод

Calculate squared Euclidean distance between two points.
public SquaredDistanceTo ( Point anotherPoint ) : float
anotherPoint Point Point to calculate distance to.
Результат float

Subtract() публичный статический Метод

Subtraction operator - subtracts values of two points.
public static Subtract ( Point point1, Point point2 ) : Point
point1 Point Point to subtract from.
point2 Point Point to subtract.
Результат Point

Subtract() публичный статический Метод

Subtraction operator - subtracts scalar from the specified point.
public static Subtract ( Point point, float valueToSubtract ) : Point
point Point Point to decrease coordinates of.
valueToSubtract float Value to subtract from coordinates of the specified point.
Результат Point

ToString() публичный Метод

Get string representation of the class.
public ToString ( ) : string
Результат string

operator() публичный статический Метод

Addition operator - adds values of two points.
public static operator ( ) : Point
Результат Point

operator() публичный статический Метод

Equality operator - checks if two points have equal coordinates.
public static operator ( ) : bool
Результат bool

Описание свойств

X публичное свойство

X coordinate.
public float X
Результат float

Y публичное свойство

Y coordinate.
public float Y
Результат float