SurfaceLocus

References
[IoId("00000000-c694-461a-80c6-88f84488325b")] public sealed class SurfaceLocus : IStorable, IEquatable<SurfaceLocus>, IComparable<SurfaceLocus>
Represents a parameter or locus on or near a surface. This type replaces the simple (u,v) surface parameters as used in RhinoCommon and Grasshopper 1.0 with a more flexible and forgiving approach.

The Kind says exactly how the coordinates and the indices are to be read; no meaning is hidden inside the index array. Every parametric locus stores two coordinates and every point three. Kinds which need fewer, SubD edges and vertices, pad the remainder with zeroes so that UV means something no matter which kind it is asked of.

Constructors

SurfaceLocus

#
public SurfaceLocus(
reader
)

SurfaceLocus

#
Create a surface locus from first principles. Consider one of the static creation methods to ensure your loci are valid.
public SurfaceLocus(
kind,
Kind.
coordinates,
Array of coordinates.
int[]
indices
Array of indices.
)

Fields

Unset

#
The unset locus.
public static readonly SurfaceLocus Unset

Properties

CoordinateCount

#
Gets the number of coordinates embedded in this locus.
public int CoordinateCount { get; }

IndexCount

#
Gets the number of indices embedded in this locus.
public int IndexCount { get; }

IsValid

#
Gets whether the locus is valid.
public bool IsValid { get; }

Kind

#
Gets the kind of locus this is. The value may be one which this version of Grasshopper does not know, either because it was defined by a plug-in or because it was written by a newer version.
public SurfaceLocusKind Kind { get; }

UV

#
Gets the UV coordinate embedded in this locus. This is only meaningful if Kind is a parametric kind.
public Point2d UV { get; }

XYZ

#
Gets the 3D coordinate embedded in this locus. This is only meaningful if Kind equals SurfaceLocusKind.Point.
public Point3d XYZ { get; }

Methods

CompareTo

#
public int CompareTo()

Coordinate

#
Gets the specified coordinate. If the index exceeds the coordinate array, zero will be returned.
public double Coordinate(
index
)

Equals

#
public override bool Equals(
obj
)
Object.Equals

Equals

#
public bool Equals()

FromIntrinsic

#
Create a surface locus from a uv parameter pair measured in the parameter space of a single indexed face.
public static SurfaceLocus FromIntrinsic(
parameter,
face
)

FromIntrinsic

#
Create a surface locus from a uv parameter pair measured in the parameter space of the surface itself.
public static SurfaceLocus FromIntrinsic(
parameter
)

FromMeshFacet

#
Create a surface locus from a barycentric coordinate on a mesh face.
public static SurfaceLocus FromMeshFacet(
face,
Index of the mesh face.
triangle,
Which triangle of a quad the coordinate is measured in. Triangular faces and the first triangle of a quad are both zero.
barycentric
First two barycentric coordinates, the third follows from the other two.
)

FromNormalised

#
Create a surface locus from a uv parameter pair in the normalised (0,1) space of a single indexed face.
public static SurfaceLocus FromNormalised(
parameter,
face
)

FromNormalised

#
Create a surface locus from a uv parameter pair in normalised (0,1) space.
public static SurfaceLocus FromNormalised(
parameter
)

FromPoint

#
Create a surface locus from a 3D point on or near a surface.
public static SurfaceLocus FromPoint(
point
)

FromSubDParameter

#
Create a surface locus from a native SubD surface parameter.

SubDs have no global (u,v) parameterisation, so a SubD locus addresses a face, an edge or a vertex by id, and stores whatever parameters that component needs.

public static SurfaceLocus FromSubDParameter(
parameter
A component parameter on a SubD.
)
A locus that resolves natively on the SubD, or Unset if the parameter addresses no component at all.

GetHashCode

#
public override int GetHashCode()
Explicit

IStorable.Store

#
void IStorable.Store(
writer
)
Store

IndexAt

#
Gets the specified index. If the index exceeds the index array, -1 will be returned.
public int IndexAt(
index
)

ResolveToParameter

#
public bool ResolveToParameter(
box,
out double
u,
out double
v,
out int
f
)

ResolveToParameter

#
public bool ResolveToParameter(
brep,
out double
u,
out double
v,
out int
face
)

ResolveToParameter

#
public bool ResolveToParameter(
plane,
out double
u,
out double
v
)

ResolveToParameter

#
public bool ResolveToParameter(
sphere,
out double
u,
out double
v
)

ResolveToParameter

#
Resolve this locus to a native SubD component parameter.

Point loci are resolved with SubD closest point, and the three SubD kinds resolve exactly. A (u,v) parameter with a face index was probably meant for a brep, but it is interpreted as best it can be.

public bool ResolveToParameter(
subd,
SubD to resolve against.
parameter
Resolved parameter, or SubDComponentParameter.Unset.
)
True if a parameter was resolved.

ResolveToParameter

#
public bool ResolveToParameter(
surface,
out double
u,
out double
v
)

ResolveToParameter

#
public bool ResolveToParameter(
tube,
out double
u,
out double
v
)

ToString

#
public override string ToString()
Object.ToString

ToString

#
public string ToString()

TryParse

#
public static Result<SurfaceLocus> TryParse(
text
)

Convertors

OperationResultDescription
implicitPoint2dSurfaceLocusCreate a surface locus from a parameter.
implicitPoint3dSurfaceLocusCreate a surface locus from a point.