Class ConicalSurfaceNP
- Namespace
- CADability.GeoObject
- Assembly
- CADability.dll
Conical surface with a uv system (parametric space) which is not periodic and has no pole. The uv system correspond to a plane through the apex perpendicular to the axis which contains the projected cone to this plane. Disadvantage is numeric precision when the opening angle is very small. A solution would be an offset and a factor which only projects the "used area" of this cone to a standard ring
public class ConicalSurfaceNP : ISurfaceImpl, ISurface, IOctTreeInsertable, IJsonSerialize, ISerializable, ICone
- Inheritance
-
ConicalSurfaceNP
- Implements
- Inherited Members
- Extension Methods
Constructors
ConicalSurfaceNP()
Empty constructor for the JSON deserialization (IJsonSerialize); the data is set by SetObjectData(IJsonReadData).
protected ConicalSurfaceNP()
ConicalSurfaceNP(GeoPoint, GeoVector, GeoVector, GeoVector)
Creates the half cone with the apex at location from a coordinate system in which the ratio of the
lengths of xAxis (same length as yAxis) and zAxis is the tangent
of half the opening angle: the point at (u, v) is location + u·xAxis + v·yAxis + sqrt(u²+v²)·zAxis. The vectors are
scaled so that xAxis gets the length 1. GetNonPeriodicSurface(ICurve[])
uses this to replace a periodic cone.
public ConicalSurfaceNP(GeoPoint location, GeoVector xAxis, GeoVector yAxis, GeoVector zAxis)
Parameters
locationGeoPointthe apex of the cone
xAxisGeoVectordirection of u in the plane perpendicular to the axis
yAxisGeoVectordirection of v, perpendicular to
xAxisandzAxis, same length asxAxiszAxisGeoVectorthe axis; only the half cone on this side of the apex is used, and the length relative to
xAxissets the opening angle
ConicalSurfaceNP(GeoPoint, GeoVector, GeoVector, GeoVector, double)
Creates the half cone with the apex at location that opens in direction zAxis with
the given half opening angle. Only the directions of xAxis, yAxis and
zAxis are used: the x and y axes are normalized and span the u/v plane perpendicular to the axis, the
z axis gets the length 1/tan(semiAngle), which encodes the opening angle (see OpeningAngle).
public ConicalSurfaceNP(GeoPoint location, GeoVector xAxis, GeoVector yAxis, GeoVector zAxis, double semiAngle)
Parameters
locationGeoPointthe apex of the cone
xAxisGeoVectordirection of u in the plane perpendicular to the axis
yAxisGeoVectordirection of v, perpendicular to
xAxisandzAxiszAxisGeoVectordirection of the axis; only the half cone on this side of the apex is used
semiAngledoublehalf of the opening angle in radians (the angle between the axis and the surface lines)
ConicalSurfaceNP(SerializationInfo, StreamingContext)
Constructor for the legacy binary deserialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.
protected ConicalSurfaceNP(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfothe data of the object
contextStreamingContextthe source of the deserialization
Properties
IsUPeriodic
Returns true, if this surface is periodic in the u direction (e.g. a cylinder) false otherwise.
public override bool IsUPeriodic { get; }
Property Value
IsVPeriodic
Returns true, if this surface is periodic in the v direction (e.g. a torus) false otherwise.
public override bool IsVPeriodic { get; }
Property Value
OpeningAngle
The full opening angle of the cone in radians, i.e. twice the angle between the axis and the surface lines. It is derived from the lengths of the x and z axes of the coordinate system.
public double OpeningAngle { get; }
Property Value
UvChangesWithModification
True when Modify(ModOp) (e.g. a rotation) changes the u/v parameter system in a way that 2d curves on the surface are no longer valid afterwards. This is the case for the non-periodic surfaces (CylindricalSurfaceNP, ConicalSurfaceNP, SphericalSurfaceNP), whose parameter system is bound to the global axes; Edge recomputes the 2d curves of its faces after a modification when this is true. False for the elementary surfaces, which carry their parameter system with them.
public override bool UvChangesWithModification { get; }
Property Value
Methods
Clone()
Returns an identical but independant copy of this surface
public override ISurface Clone()
Returns
CopyData(ISurface)
Copies the data of the given surface to this surface. The two surfaces are guaranteed to be of the same type. (Used after Clone() and Modify(ModOp) to restore the original values).
public override void CopyData(ISurface copyFrom)
Parameters
copyFromISurface
DebugImplicit(GeoPoint)
Evaluates an expanded form of the implicit equation of the cone at p. Only used to check
GetImplicitPolynomial() during development; the value is 0 for points on the cone and is not scaled to a
distance.
public double DebugImplicit(GeoPoint p)
Parameters
pGeoPointthe point to test
Returns
- double
the value of the implicit function at
p
Derivation2At(GeoPoint2D, out GeoPoint, out GeoVector, out GeoVector, out GeoVector, out GeoVector, out GeoVector)
Returns the point, the two first derivations and the three second derivations of the surface at the provided parameter position.
public override void Derivation2At(GeoPoint2D uv, out GeoPoint p, out GeoVector du, out GeoVector dv, out GeoVector duu, out GeoVector dvv, out GeoVector duv)
Parameters
uvGeoPoint2DPoint in the parameter space
pGeoPointduGeoVectorResulting derivation in u
dvGeoVectorResulting derivation in v
duuGeoVectordvvGeoVectorduvGeoVector
DerivationAt(GeoPoint2D, out GeoPoint, out GeoVector, out GeoVector)
Returns the point and the two derivations of the suface in a single call. It returns the same result as calling PointAt(GeoPoint2D), VDirection(GeoPoint2D) und VDirection(GeoPoint2D) succesively but is often faster than the three seperate calls.
public override void DerivationAt(GeoPoint2D uv, out GeoPoint p, out GeoVector du, out GeoVector dv)
Parameters
uvGeoPoint2DPoint in the parameter space
pGeoPointduGeoVectorResulting derivation in u
dvGeoVectorResulting derivation in v
FixedU(double, double, double)
Returns a curve where the u parameter of this surface is fixed and the v parameter starts a vmin and ends at vmax
public override ICurve FixedU(double u, double vMin, double vMax)
Parameters
Returns
FixedV(double, double, double)
Returns a curve where the v parameter of this surface is fixed and the u parameter starts a umin and ends at umax
public override ICurve FixedV(double v, double uMin, double uMax)
Parameters
Returns
GetImplicitPolynomial()
Returns the implicit form of the surface: a polynomial in x, y and z which is zero exactly for the points of the surface and whose value approximates the (signed) distance of a point from the surface. It is used to speed up intersections and distance computations with other surfaces. The base implementation returns null; the elementary surfaces (e.g. CylindricalSurface, ToroidalSurface) override it.
public override Polynom GetImplicitPolynomial()
Returns
- Polynom
The implicit polynomial, or null when not available for this type of surface
GetModified(ModOp)
Returns a clone of this surface modified by the given ModOp.
public override ISurface GetModified(ModOp m)
Parameters
mModOphow to modify
Returns
GetObjectData(IJsonWriteData)
Writes the apex and the three axes for the JSON serialization (IJsonSerialize).
public void GetObjectData(IJsonWriteData data)
Parameters
dataIJsonWriteDatareceives the properties
GetProjectedCurve(ICurve, double)
Returns the projection of the given curve in 2D coordinates. Should only be used for curves that are close to the surface.
public override ICurve2D GetProjectedCurve(ICurve curve, double precision)
Parameters
curveICurvethe 3d curve to project onto this surface
precisiondoublemaximum allowed deviation of the resulting 2d curve (mapped onto the surface) from the provided curve
Returns
GetPropertyEntry(IFrame)
Gets the IPropertyEntry to display this surface in the property grid (may be null)
public override IPropertyEntry GetPropertyEntry(IFrame frame)
Parameters
frameIFrame
Returns
GetTangentCurves(GeoVector, double, double, double, double)
Returns curves where direction is perpendicular to the normal vector
public override ICurve2D[] GetTangentCurves(GeoVector direction, double uMin, double uMax, double vMin, double vMax)
Parameters
Returns
- ICurve2D[]
Make3dCurve(ICurve2D)
Returns a 3-dimensional curve from the given 2-dimensional curve. the 2-dimensional curve is interpreted in the u/v system of the surface.
public override ICurve Make3dCurve(ICurve2D curve2d)
Parameters
curve2dICurve2Dthe base curve
Returns
- ICurve
corresponding 3-d curve
Modify(ModOp)
Modifies this surface with the given operation
public override void Modify(ModOp m)
Parameters
mModOphow to modif
PerpendicularFoot(GeoPoint)
Returns a list of perpendicular foot points of the surface. The list may be empty
public override GeoPoint2D[] PerpendicularFoot(GeoPoint fromHere)
Parameters
fromHereGeoPointSource point for the perpendicular foot
Returns
- GeoPoint2D[]
Array of foot-points, may be empty
PointAt(GeoPoint2D)
Returns the 3-dimensional point at the given u/v point
public override GeoPoint PointAt(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoPoint
point
PositionOf(GeoPoint)
Returns the u/v position of the given point. It is assumed that the point is on the surface, if not the result is undetermined.
public override GeoPoint2D PositionOf(GeoPoint p)
Parameters
pGeoPointpoint
Returns
- GeoPoint2D
position
ReverseOrientation()
Reverses the orientation of this surface. The normal vector will point to the other side after this operation. The returned ModOp2D determins how (u,v) coordinates of the parameter space have to be transformed to define the same 3d point.
public override ModOp2D ReverseOrientation()
Returns
- ModOp2D
Transformation of the parameter space
SameGeometry(BoundingRect, ISurface, BoundingRect, double, out ModOp2D)
Returns true if this surface and the other surface are geometrically identical, i.e. describe the same surface
in 3D space. The may have a different u/v system. The returned firstToSecond contains
the ModOp to convert from the u/v system of the first surface to the second surface.
public override bool SameGeometry(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, double precision, out ModOp2D firstToSecond)
Parameters
thisBoundsBoundingRectBounds for this surface
otherISurfaceOther surface
otherBoundsBoundingRectBounds of other surface
precisiondoubleRequired precision
firstToSecondModOp2DTransformation between different u/v systems
Returns
- bool
True if the surfaces are geometrically equal
SetObjectData(IJsonReadData)
Reads the data written by GetObjectData(IJsonWriteData) for the JSON deserialization (IJsonSerialize).
public void SetObjectData(IJsonReadData data)
Parameters
dataIJsonReadDataprovides the properties
UDirection(GeoPoint2D)
Returns the direction at the given u/v point in direction of the u-axis
public override GeoVector UDirection(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoVector
direction
VDirection(GeoPoint2D)
Returns the direction at the given u/v point in direction of the v-axis
public override GeoVector VDirection(GeoPoint2D uv)
Parameters
uvGeoPoint2Dposition
Returns
- GeoVector
direction