Table of Contents

Class PairZrUtil

Namespace
Hi.Geom
Assembly
HiGeom.dll

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

src IEnumerable<PairZr>
ZResolution double

Returns

IEnumerable<PairZr>

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

zrs IReadOnlyList<PairZr>

The profile points; consecutive non-null points form the segments

z double

The Z position

Returns

double

The largest R over the segments spanning z; NaN when no segment spans it (fewer than two points, z outside the profile, or z NaN)

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

zVsPairZr List<PairZr>

The list of PairZr objects

z double

The 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

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

zVsPairZr SortedList<double, PairZr>

The sorted list of PairZr objects keyed by Z values

z double

The 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

src IGetZrList

The 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

src IEnumerable<PairZr>

Returns

double

GetZrList(IGetStl)

Extracts a list of PairZr objects from an object that implements IGetStl

public static List<PairZr> GetZrList(this IGetStl geom)

Parameters

geom IGetStl

The object that implements IGetStl

Returns

List<PairZr>

A list of PairZr objects, or null if the geometry is null

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

tris IEnumerable<tri3d_t>

The collection of triangles

Returns

List<PairZr>

A list of PairZr objects ordered by Z value

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

zVsPairZr SortedList<double, PairZr>

The sorted list of PairZr objects defining the surface

z double

The Z position to get the normal vector for

normal vec2d_t

The 2D normal vector to the surface, when the method returns true

Returns

bool

True when z lies inside the list's Z range; false when the list is empty, z is NaN, or z is 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

zVsPairZr SortedList<double, PairZr>

The sorted list of PairZr objects defining the surface

z double

The Z position to get the normal vector for

fittedZ double

Output parameter that receives the adjusted Z value that fits within the range; NaN when the list is empty or z is NaN

normal vec2d_t

The 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 z is 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

zVsPairZr List<PairZr>

The list of PairZr objects defining the surface

z double

The Z position to get the vector for

arrow vec2d_t

The 2D vector perpendicular to the surface, when the method returns true

Returns

bool

True when z lies inside the contour's Z range; false when the list is empty, z is NaN, or z is 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

zVsPairZr List<PairZr>

The list of PairZr objects defining the surface

z double

The Z position to get the vector for

fittedZ double

Output parameter that receives the adjusted Z value that fits within the range; NaN when the list is empty or z is NaN

arrow vec2d_t

The 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 z is 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

zVsPairZr List<PairZr>

The list of PairZr objects defining the surface

z double

The Z position to get the vector for

angle_rad double

The angle in radians to position the vector around the Z axis

fittedZ double

Output parameter that receives the adjusted Z value that fits within the range; NaN when the list is empty or z is NaN

arrow vec3d_t

The 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 z is NaN