Class CGShape
- Namespace
- FluffyUnderware.Curvy.Generator
Rasterized Shape Data (Polyline)
[CGDataInfo(0.73, 0.87, 0.98, 1)]
public class CGShape : CGData
- Inheritance
-
CGShape
- Derived
- Inherited Members
Constructors
CGShape()
public CGShape()
CGShape(CGShape)
public CGShape(CGShape source)
Parameters
sourceCGShape
Fields
Closed
Whether the base spline is closed or not
public bool Closed
Field Value
Length
Length in world units
public float Length
Field Value
MaterialGroups
Groups/Patches
public List<SamplePointsMaterialGroup> MaterialGroups
Field Value
Seamless
Whether the Shape/Path is seamless, i.e. Closed==true and the whole length is covered
public bool Seamless
Field Value
SourceIsManaged
Whether the source is managed or not
public bool SourceIsManaged
Field Value
Remarks
This could be used to determine if values needs to be transformed into generator space or not
Properties
Count
Gets the number of sample points
public override int Count { get; }
Property Value
CustomValues
Arbitrary mapped value to each point, usually U coordinate
public SubArray<float> CustomValues { get; set; }
Property Value
Remarks
Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance
DuplicatePoints
The list of the shape's DuplicatePoints
public List<DuplicateSamplePoint> DuplicatePoints { get; set; }
Property Value
Normals
Normals of the path's points, in the path's local space
public SubArray<Vector3> Normals { get; set; }
Property Value
- SubArray<Vector3>
Remarks
Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance
Positions
Positions of the path's points, in the path's local space
public SubArray<Vector3> Positions { get; set; }
Property Value
- SubArray<Vector3>
Remarks
Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance
RelativeDistances
The relative distance of each point. A relative distance is a value between 0 and 1 representing how far the point is in a shape. A value of 0 means the start of the shape, and a value of 1 means the end of it. It is defined as (the point's distance from the shape's start) / (the total length of the shape) This is unrelated to the notion of TF or F of a spline. Unfortunately, it is abusively called F in big parts of the the Curvy Generator related code, sorry for the confusion.
public SubArray<float> RelativeDistances { get; set; }
Property Value
Remarks
Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance
SourceRelativeDistances
The relative distance of each point relative to the source shape. A relative distance is a value between 0 and 1 representing how far the point is in a shape. A value of 0 means the start of the shape, and a value of 1 means the end of it. It is defined as (the point's distance from the shape's start) / (the total length of the shape) Contrary to RelativeDistances which is computed based on the actual shape, SourceRelativeDistances is computed based on the source shape. For example, if a Shape A is defined as the second quarter of a Shape B, A's first point will have a relative distance of 0, but a source relative distance of 0.25. A's last point will have a relative distance of 1, but a source relative distance of 0.5 This is unrelated to the notion of TF or F of a spline. Unfortunately, it is abusively called F in big parts of the the Curvy Generator related code, sorry for the confusion.
public SubArray<float> SourceRelativeDistances { get; set; }
Property Value
Remarks
Setting a new SubArray<T> will Free(SubArray<T>) the current SubArray<T> instance
Methods
Clone<T>()
public override T Clone<T>() where T : CGData
Returns
- T
Type Parameters
T
Copy(CGShape)
public void Copy(CGShape source)
Parameters
sourceCGShape
Copy(CGShape, CGShape)
public static void Copy(CGShape dest, CGShape source)
Parameters
Dispose(bool)
protected override bool Dispose(bool disposing)
Parameters
disposingbool
Returns
DistanceToF(float)
Converts absolute (World Units) to relative (F) distance
public float DistanceToF(float distance)
Parameters
distancefloatdistance in world units
Returns
- float
Relative distance (0..1)
FToDistance(float)
Converts relative (F) to absolute distance (World Units)
public float FToDistance(float f)
Parameters
ffloatrelative distance (0..1)
Returns
- float
Distance in World Units
GetFIndex(float, out float)
Gets the index of a certain F
public int GetFIndex(float f, out float frag)
Parameters
Returns
- int
the resulting index
Interpolate(float, out Vector3, out Vector3)
Interpolates Position and Normal by F
public void Interpolate(float f, out Vector3 position, out Vector3 up)
Parameters
ffloat0..1
positionVector3upVector3a.k.a normal
InterpolatePosition(float)
Interpolates Position by F
public Vector3 InterpolatePosition(float f)
Parameters
ffloat0..1
Returns
- Vector3
the interpolated position
InterpolateUp(float)
Interpolates Normal by F
public Vector3 InterpolateUp(float f)
Parameters
ffloat0..1
Returns
- Vector3
the interpolated normal
Move(ref float, ref int, float, CurvyClamping)
public void Move(ref float f, ref int direction, float speed, CurvyClamping clamping)
Parameters
ffloatdirectionintspeedfloatclampingCurvyClamping
MoveBy(ref float, ref int, float, CurvyClamping)
public void MoveBy(ref float f, ref int direction, float speedDist, CurvyClamping clamping)
Parameters
ffloatdirectionintspeedDistfloatclampingCurvyClamping
Recalculate()
Recalculate Length and RelativeDistances (by measuring a polyline built from all Position points)
public virtual void Recalculate()
Remarks
Call this after TRS'ing a shape
RecalculateNormals()
public void RecalculateNormals()
RecalculateNormals(CurvySpline)
Recalculate the shape's Normals based on the spline the shape was rasterized from
public void RecalculateNormals(CurvySpline spline)
Parameters
splineCurvySpline