Class Cylindroid
3d Geometry of Cylindroid.
public class Cylindroid : IStlSource, IGetStl, IMakeXmlSource, IExpandToBox3d, IGetZrContour, IDuplicate, IGetZrList, IGenStl, IToPresentDto
- Inheritance
-
Cylindroid
- Implements
- Inherited Members
- Extension Methods
Constructors
Cylindroid()
Initializes a new instance of the Cylindroid class with an empty list of PairZr objects.
public Cylindroid()
Cylindroid(Cylindroid)
Initializes a new instance of the Cylindroid class by copying another Cylindroid.
public Cylindroid(Cylindroid src)
Parameters
srcCylindroidThe source Cylindroid to copy from.
Cylindroid(params PairZr[])
Ctor. The order of z values should be from small to large in general case.
public Cylindroid(params PairZr[] pairZRs)
Parameters
Cylindroid(XElement)
Ctor.
public Cylindroid(XElement src)
Parameters
srcXElementXML
Fields
ProfileTolerance_mm
Profile snapping tolerance (mm) used by GenStl(IPolarResolution2d): a radius
within it is the axis, and a point within it of the previous kept point
is a duplicate. Authoring tools emit such points — e.g. a chamfer tip
stored as (0, 0), (0, 4.4e-16) — and a duplicate would revolve
into a ring of zero-area triangles. The exact-arithmetic sweep in
the native core cannot orient a zero-area triangle (its cross
product reduces to the zero vector) and aborts the process, so the
mesh must never carry one.
public const double ProfileTolerance_mm = 1E-09
Field Value
Properties
DefaultPolarResolution2d
Default polar resolution.
public static IPolarResolution2d DefaultPolarResolution2d { get; set; }
Property Value
PairZrs
ZR values. The order of z values should be from small to large in general case.
public List<PairZr> PairZrs { get; set; }
Property Value
UnitCylinder
Generate a cylindroid that height is 1 and radius is 0.5.
public static Cylindroid UnitCylinder { get; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
Duplicate(params object[])
Creates a deep copy of the object, excluding any source file references.
public object Duplicate(params object[] res)
Parameters
resobject[]Optional parameters that may be needed during the duplication process
Returns
- object
A new instance that is a deep copy of the original object
ExpandToBox3d(Box3d)
Expands the destination box. This function is usually used to compute the bounding box of elements.
public void ExpandToBox3d(Box3d dst)
Parameters
dstBox3dDestination box
GenCylinder(double, double)
Generates a cylinder with the specified height and radius.
public static Cylindroid GenCylinder(double height, double r)
Parameters
Returns
- Cylindroid
A new Cylindroid representing the cylinder.
GenStl(IPolarResolution2d)
Generates a new STL.
public Stl GenStl(IPolarResolution2d resolution)
Parameters
resolutionIPolarResolution2dPolar resolution
Returns
- Stl
A newly created STL.
GetStl()
Gets the STL mesh at DefaultPolarResolution2d. Resolution-aware callers pass their value through GenStl(IPolarResolution2d) instead.
public Stl GetStl()
Returns
- Stl
The STL mesh at the default resolution.
GetZrContour(double)
Gets Z-R contour data as a list of PairZr objects. The Z values should generally be ordered from smallest to largest.
public IList<PairZr> GetZrContour(double latitudeAngleResolution_rad)
Parameters
latitudeAngleResolution_raddoubleResolution of latitude angle in radians
Returns
GetZrList()
Gets a list of Z-R coordinate pairs.
public List<PairZr> GetZrList()
Returns
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
NormalizeProfile(IEnumerable<PairZr>)
Returns src with radii within
ProfileTolerance_mm of the axis snapped to 0 and
consecutive points within that tolerance of each other merged.
public static List<PairZr> NormalizeProfile(IEnumerable<PairZr> src)
Parameters
srcIEnumerable<PairZr>
Returns
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory
ToPresentDto()
Convert Cylindroid to presentation DTO (Data Transfer Object) for JSON serialization. The returned object includes type metadata for web API presentation.
public object ToPresentDto()
Returns
- object
DTO dictionary with Type and PairZrs keys