Table of Contents

Class VectorMath

Namespace
NetTopologySuite.Mathematics
Assembly
NetTopologySuite.dll

Functions for performing vector mathematics.

public static class VectorMath
Inheritance
VectorMath
Inherited Members

Methods

CrossProduct(Coordinate, Coordinate)

Computes the cross product of v1 and v2

public static Coordinate CrossProduct(Coordinate v1, Coordinate v2)

Parameters

v1 Coordinate

A vector

v2 Coordinate

A vector

Returns

Coordinate

The cross product of v1 and v2

Det(double, double, double, double)

Computes the determinant of a 2x2 matrix

public static double Det(double a1, double a2, double b1, double b2)

Parameters

a1 double

The m[0,0] value

a2 double

The m[0,1] value

b1 double

The m[1,0] value

b2 double

The m[1,1] value

Returns

double

The determinant

DotProduct(Coordinate, Coordinate)

Computes the dot product of v1 and v2

public static double DotProduct(Coordinate v1, Coordinate v2)

Parameters

v1 Coordinate

A vector

v2 Coordinate

A vector

Returns

double

The dot product of v1 and v2

NormalToTriangle(Coordinate, Coordinate, Coordinate)

Computes the normal vector to the triangle p0-p1-p2. In order to compute the normal each triangle coordinate must have a Z value. If this is not the case, the returned Coordinate will have NaN values. The returned vector has unit length.

public static Coordinate NormalToTriangle(Coordinate p0, Coordinate p1, Coordinate p2)

Parameters

p0 Coordinate

A point

p1 Coordinate

A point

p2 Coordinate

A point

Returns

Coordinate

The normal vector to the triangle p0-p1-p2

Normalize(Coordinate)

Normalizes the vector v

public static void Normalize(Coordinate v)

Parameters

v Coordinate

The normalized v