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(IReader reader)
reader (IReader)

SurfaceLocus

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

Fields

Unset

#
public static readonly SurfaceLocus Unset
The unset locus.

Properties

CoordinateCount

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

IndexCount

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

IsValid

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

Kind

#
public SurfaceLocusKind Kind { get; }
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.

UV

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

XYZ

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

Methods

CompareTo

#
public int CompareTo(SurfaceLocus other)
other (SurfaceLocus)

Coordinate

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

Equals

#
public override bool Equals(object obj)
obj (object)
Object.Equals

Equals

#
public bool Equals(SurfaceLocus other)
other (SurfaceLocus)

FromIntrinsic

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

FromIntrinsic

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

FromMeshFacet

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

FromNormalised

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

FromNormalised

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

FromPoint

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

FromSubDParameter

#
public static SurfaceLocus FromSubDParameter(SubDComponentParameter parameter)
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.

parameter (SubDComponentParameter)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(IWriter writer)
writer (IWriter)
Store

IndexAt

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

ResolveToParameter

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

ResolveToParameter

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

ResolveToParameter

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

ResolveToParameter

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

ResolveToParameter

#
public bool ResolveToParameter(SubD subd, out SubDComponentParameter parameter)
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.

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

ResolveToParameter

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

ResolveToParameter

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

ToString

#
public override string ToString()
Object.ToString

ToString

#
public string ToString(NumberFormat format)
format (NumberFormat)

TryParse

#
public static Result<SurfaceLocus> TryParse(string text)
text (string)

Convertors

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