VectorExtensionMethods

public static class VectorExtensionMethods
Extension methods for Eto.Drawing.SizeF, Vector2d and Vector3d.

Methods

Compute the clockwise and anti-clockwise angles between two vectors.
public static bool Angle(
this Vector2d
a,
First vector.
b,
Second vector.
out double
clockWise,
Clockwise angle from a to b.
out double
anticlockWise
Anti-clockwise angle from a to b.
)
Measure the angle from the plane x-axis to the projection of the xyz point.
public static double Angle(
this Plane
plane,
xyz
)

Average

#Example
Compute the average of a collection of points.
public static Point3d Average(
points
Points to average.
)
Average point.

Average

#Example
Compute the average of a collection of points.
public static Point3d Average(
this Point3d[]
points
Points to average.
)
Average point.

ClosestParameter

#Example
Gets the parameter on a semi-finite ray which best approximates a 3D point.
public static double ClosestParameter(
this Ray3d
ray,
point
)

CompareTo

#Example
Comparison of two planes.
public static int CompareTo(
this Plane
plane,
other
)

CreatePerpendicular

#Example
Create a vector perpendicular to the input vector using custom primary and secondary axes. The length of the perpendicular vector will be identical to the length of the secondary axis, not the input vector.
public static Vector3d CreatePerpendicular(
this Vector3d
vector,
Input vector.
primary,
Custom primary axis direction.
secondary
Custom secondary axis direction. Should be perpendicular to the primary axis./
)

CreatePerpendicular

#Example
Create a vector perpendicular to the input vector using default primary and secondary axes. The length of the perpendicular vector will be 1.0
public static Vector3d CreatePerpendicular(
this Vector3d
vector
)

DistanceTo

#Example
Gets the smallest distance from a semi-finite ray to a 3D point.
public static double DistanceTo(
this Ray3d
ray,
point
)

FindMagnitude

#Example
Attempt to find a field scalar value along a finite line segment using binary-like searching.
public static bool FindMagnitude(
this Field
field,
Field to sample.
target,
Target scalar.
axis,
Search space.
out double
parameter
Parameter on search space which most closely matches the target scalar.
)
True if the target magnitude was found on the axis interior, false if otherwise.
Flip a vector if the flipped direction better aligns with a guide vector.
public static Vector2d Flip(
this Vector2d
vector,
Vector to flip.
guide
Guide vector.
)
Flipped vector (or not).
Flip a vector if the flipped direction better aligns with a guide vector.
public static Vector3d Flip(
this Vector3d
vector,
Vector to flip.
guide
Guide vector.
)
Flipped vector (or not).

IntersectWithLine

#Example
Intersect a plane with a finite line segment.
public static bool IntersectWithLine(
this Plane
plane,
Plane.
line,
Line segment.
domain0,
Domain at start of line.
domain1,
Domain at end of line.
out double
t
Intersection parameter on line domain.
)
True if intersection happened.

IsSize

#Example
Test whether a matrix has a specific size.
public static bool IsSize(
this Matrix
matrix,
Matrix.
rowCount,
Row count.
columnCount
ColumnCount.
)
True if matrix is this exact size.

IsSize

#Example
Test whether a matrix has a specific size.
public static bool IsSize(
this Matrix
matrix,
Matrix to test.
params (int rows, int columns)[]
sizes
Potential sizes.
)
True if matrix is this exact size.

LineSpan

#Example
Get the domain on a line segment which perpendicularly spans an entire box.
public static Interval LineSpan(
this Line
line,
box
)

LineSpan

#Example
Get the domain on a line segment which perpendicularly spans an entire box.
public static Interval LineSpan(
this Line
line,
box
)

LineSpan

#Example
Get the domain on a line segment which perpendicularly spans an entire box.
public static Interval LineSpan(
this Line
line,
points
Points to span.
)

LineSpan

#Example
Get the domain on a line segment which perpendicularly spans an entire box.
public static Interval LineSpan(
this Line
line,
params Point3d[]
points
Points to span.
)

PointAt

#Example
Evaluate the plane at a given coordinate.
public static Point3d PointAt(
this Plane
plane,
uv
)

PointAt

#Example
Evaluate the plane at a given coordinate.
public static Point3d PointAt(
this Plane
plane,
uvw
)

ProjectUV

#Example
Rewrite a point in world coordinates in two-dimensional uv coordinates.
public static Point2d ProjectUV(
this Plane
plane,
point
)
Point in plane UV coordinates.

ProjectUVW

#Example
Rewrite a point in world coordinates in two-dimensional uv coordinates.
public static Point3d ProjectUVW(
this Plane
plane,
point
)
Point in plane UV coordinates.
Perform slerp interpolation on two vectors.
public static Vector3d Slerp(
this Vector3d
vector,
other,
factor
)
Convert a SizeF into a Point2d.
public static Vector2d To2d(
this SizeF
size
Size.
)
Vector.
Convert a Vector3d into a Vector2d.
public static Vector2d To2d(
this Vector3d
vector
Vector.
)
Vector.
Convert a Point3f into a Point3d.
public static Point3d To3d(
this Point3f
point
)
Convert a SizeF into a Vector3d.
public static Vector3d To3d(
this SizeF
size
Size.
)
Vector.
Convert a Vector2d into a Vector3d.
public static Vector3d To3d(
this Vector2d
vector
Vector.
)
Vector.
public static Vector3d To3d(
this Vector3f
vector
)
Convert a Vector3d into a Vector2d.
public static Vector3f To3f(
this Vector3d
vector
Vector.
)
Vector.

ToComplex

#Example
Convert a column or row matrix with two cells into a complex number.
public static Complex ToComplex(
this Matrix
matrix
)
Complex number.

ToMathNetMatrix

#Example
Convert a RhinoCommon matrix into a MathNet matrix.
public static Matrix ToMathNetMatrix(
this Matrix
matrix
)

ToPoint3d

#Example
Convert a column or row matrix with three cells into a point.
public static Point3d ToPoint3d(
this Matrix
matrix
)
Point.

ToRhinoCommonMatrix

#Example
Convert a MathNet matrix into a RhinoCommon matrix.
public static Matrix ToRhinoCommonMatrix(
this Matrix<double>
matrix
)

ToSize

#Example
Convert a SizeF into a Size.
public static Size ToSize(
this SizeF
point
Size to convert.
)
Size.

ToSizeF

#Example
Convert a Vector2d to a SizeF.
public static SizeF ToSizeF(
this Vector2d
vector
Vector.
)
XY projection of vector.

ToSizeF

#Example
Convert a Vector3d to a SizeF.
public static SizeF ToSizeF(
this Vector3d
vector
Vector.
)
XY projection of vector.

ToTransform

#Example
Convert a 3×3, or 4×3, or 4×4 matrix into a transformation.
public static Transform ToTransform(
this Matrix
matrix
Matrix to transform.
)
Transformation.

ToVector3d

#Example
Convert a column or row matrix with three cells into a vector.
public static Vector3d ToVector3d(
this Matrix
matrix
)
Vector.

TransformDirection

#Example
Transform a vector spatially. This is needed when transforming vectors using shear or taper matrices. This method differs from the standard Vector3d.Transform method in that it retains perpendicularity through taper and shear deformations. This method does not guarantee that the magnitude of the result is anywhere near correct, it is only concerned with the direction.
public static Vector3d TransformDirection(
this Vector3d
vector,
Vector to transform.
transform,
Transformation.
anchor
Anchor point for vector.
)
Transformed vector.