Class Mathematics
- Namespace
- Hymma.Solidworks.Extensions
- Assembly
- Hymma.Solidworks.Extensions.dll
provides numerous helper classes for unit conversion, mathematical calculations etc
public static class Mathematics
- Inheritance
-
Mathematics
- Inherited Members
Methods
AlmostEqual(double, double, double)
determine if two numbers are in the same range of each other
specifically useful when you want to know if two numbers are equal if you disregard tiny differences in values
public static bool AlmostEqual(double num1, double num2, double tolerance = 5E-324)
Parameters
Returns
Remarks
this method should help with the fact that double values lose percision in arithmetic operations
AlmostEqual(double, double, int)
This method should help with the fact that double values lose percision in arithmetic operations. Determine if two numbers are in the same range of each other specifically useful when you want to know if two numbers are equal if you disregard tiny differences in values
public static bool AlmostEqual(double v1, double v2, int digits = 5)
Parameters
v1doublev2doubledigitsintthe difference between the two numbers will be rounded to this decimal point
Returns
Remarks
Two numbers are almost equal to each other when their value is assessed against another number. As our environment is manufacturing and the most accurate devices (wire cutters) have a percision of 1E-5 meters we should round differences of the two numbers to that percision
AlmostEqual(double[], double[], int)
determines if two vectors are in the same range of each other
specifically useful when you want to know if two vectors are equal if you disregard tiny differences in values
public static bool AlmostEqual(double[] vector1, double[] vector2, int digits = 5)
Parameters
vector1double[]vector2double[]digitsintthe difference between the two numbers will be rounded to this decimal point
Returns
- bool
true if all members of each vector (array) are equal to a certain tolerance and false otherwise
Remarks
this method should help with the fact that double values lose percision in arithmetic operations
VectorsCross(double[], double[])
calculate the cross product of two vectors
public static double[] VectorsCross(double[] v1, double[] v2)
Parameters
Returns
- double[]
V1 x V2 or {0,0,0} on error
VectorsDot(double[], double[])
calculate the dot product of two vectors
public static double VectorsDot(double[] v1, double[] v2)
Parameters
Returns
- double
V1.V2 or -1 on error