Class PairZrUtil
Utility class for working with PairZr objects
public static class PairZrUtil
- Inheritance
-
PairZrUtil
- Inherited Members
Methods
GetIntensiveZrs(IEnumerable<PairZr>, double)
public static IEnumerable<PairZr> GetIntensiveZrs(this IEnumerable<PairZr> src, double ZResolution)
Parameters
srcIEnumerable<PairZr>ZResolutiondouble
Returns
GetMaxRByZ(IReadOnlyList<PairZr>, double)
Gets the largest R of a profile at a specified Z position: every segment between two
consecutive points that spans z contributes its interpolated R, and a
vertical step at z (two consecutive points with the same Z) contributes
the larger of its two radii. The points need not be sorted; null elements are skipped.
Where GetRByZ(List<PairZr>, double) answers one side of a step, depending on
which point its search lands on, this is the outer surface a plane at z
cuts.
public static double GetMaxRByZ(this IReadOnlyList<PairZr> zrs, double z)
Parameters
zrsIReadOnlyList<PairZr>The profile points; consecutive non-null points form the segments
zdoubleThe Z position
Returns
- double
The largest R over the segments spanning
z; NaN when no segment spans it (fewer than two points,zoutside the profile, orzNaN)
GetRByZ(List<PairZr>, double)
Gets the R value at a specified Z position by interpolating between PairZr objects in a list
public static double GetRByZ(this List<PairZr> zVsPairZr, double z)
Parameters
Returns
- double
The interpolated R value at the specified Z position, or NaN if interpolation is not possible
GetRByZ(SortedList<double, PairZr>, double)
Gets the R value at a specified Z position by interpolating between PairZr objects in a sorted list
public static double GetRByZ(this SortedList<double, PairZr> zVsPairZr, double z)
Parameters
zVsPairZrSortedList<double, PairZr>The sorted list of PairZr objects keyed by Z values
zdoubleThe Z position to get the R value for
Returns
- double
The interpolated R value at the specified Z position, or NaN if interpolation is not possible
GetVolume(IGetZrList)
Calculates the volume of an object that implements IGetZrList
public static double GetVolume(this IGetZrList src)
Parameters
srcIGetZrListThe object that implements IGetZrList
Returns
- double
The calculated volume, or 0 if the source is null
GetVolume(IEnumerable<PairZr>)
Get Volume. Assume the src.Z is ascendent.
If Z descendent, the result may be negative.
public static double GetVolume(this IEnumerable<PairZr> src)
Parameters
srcIEnumerable<PairZr>
Returns
GetZrList(IGetStl)
Extracts a list of PairZr objects from an object that implements IGetStl
public static List<PairZr> GetZrList(this IGetStl geom)
Parameters
geomIGetStlThe object that implements IGetStl
Returns
GetZrList(IEnumerable<tri3d_t>)
Extracts a list of PairZr objects from a collection of triangles
public static List<PairZr> GetZrList(this IEnumerable<tri3d_t> tris)
Parameters
trisIEnumerable<tri3d_t>The collection of triangles
Returns
TryGetNormal2d(SortedList<double, PairZr>, double, out vec2d_t)
Tries to get a 2D normal vector to the surface at the specified Z position
public static bool TryGetNormal2d(this SortedList<double, PairZr> zVsPairZr, double z, out vec2d_t normal)
Parameters
zVsPairZrSortedList<double, PairZr>The sorted list of PairZr objects defining the surface
zdoubleThe Z position to get the normal vector for
normalvec2d_tThe 2D normal vector to the surface, when the method returns true
Returns
- bool
True when
zlies inside the list's Z range; false when the list is empty,zis NaN, orzis below the first or above the last Z
TryGetNormal2dByFittedZ(SortedList<double, PairZr>, double, out double, out vec2d_t)
Tries to get a 2D normal vector to the surface at the specified Z position, adjusted to fit within the Z range
public static bool TryGetNormal2dByFittedZ(this SortedList<double, PairZr> zVsPairZr, double z, out double fittedZ, out vec2d_t normal)
Parameters
zVsPairZrSortedList<double, PairZr>The sorted list of PairZr objects defining the surface
zdoubleThe Z position to get the normal vector for
fittedZdoubleOutput parameter that receives the adjusted Z value that fits within the range; NaN when the list is empty or
zis NaNnormalvec2d_tThe 2D normal vector to the surface, when the method returns true
Returns
- bool
True when the normal exists; false when the list is empty or
zis NaN
TryGetSurfaceVerticalArrow2d(List<PairZr>, double, out vec2d_t)
Tries to get a 2D vector perpendicular to the surface at the specified Z position
public static bool TryGetSurfaceVerticalArrow2d(this List<PairZr> zVsPairZr, double z, out vec2d_t arrow)
Parameters
zVsPairZrList<PairZr>The list of PairZr objects defining the surface
zdoubleThe Z position to get the vector for
arrowvec2d_tThe 2D vector perpendicular to the surface, when the method returns true
Returns
- bool
True when
zlies inside the contour's Z range; false when the list is empty,zis NaN, orzis below the first or above the last Z
TryGetSurfaceVerticalArrow2dByFittedZ(List<PairZr>, double, out double, out vec2d_t)
Tries to get a 2D vector perpendicular to the surface at the specified Z position, adjusted to fit within the Z range
public static bool TryGetSurfaceVerticalArrow2dByFittedZ(this List<PairZr> zVsPairZr, double z, out double fittedZ, out vec2d_t arrow)
Parameters
zVsPairZrList<PairZr>The list of PairZr objects defining the surface
zdoubleThe Z position to get the vector for
fittedZdoubleOutput parameter that receives the adjusted Z value that fits within the range; NaN when the list is empty or
zis NaNarrowvec2d_tThe 2D vector perpendicular to the surface, when the method returns true
Returns
- bool
True when the surface vector exists; false when the list is empty or
zis NaN
TryGetSurfaceVerticalArrow3dByFittedZ(List<PairZr>, double, double, out double, out vec3d_t)
Tries to get a 3D vector perpendicular to the surface at the specified Z position, adjusted to fit within the Z range
public static bool TryGetSurfaceVerticalArrow3dByFittedZ(this List<PairZr> zVsPairZr, double z, double angle_rad, out double fittedZ, out vec3d_t arrow)
Parameters
zVsPairZrList<PairZr>The list of PairZr objects defining the surface
zdoubleThe Z position to get the vector for
angle_raddoubleThe angle in radians to position the vector around the Z axis
fittedZdoubleOutput parameter that receives the adjusted Z value that fits within the range; NaN when the list is empty or
zis NaNarrowvec3d_tThe 3D vector perpendicular to the surface, when the method returns true
Returns
- bool
True when the surface vector exists; false when the list is empty or
zis NaN