Table of Contents

Class Vertex

Namespace
CADability
Assembly
CADability.dll

Describes a vertex of an Edge. A vertex is the start or endpoint of an edge. It connects at least two edges but can belong to any number of edges.

public class Vertex : IComparable<Vertex>, IOctTreeInsertable, ISerializable, IDeserializationCallback, IJsonSerialize, IExportStep
Inheritance
Vertex
Implements
Inherited Members

Constructors

Vertex()

Creates an empty vertex for the JSON deserialization (see SetObjectData(IJsonReadData)).

protected Vertex()

Vertex(GeoPoint)

Creates a vertex at position without edges. Edges are attached when they get this vertex as their start or end vertex (e.g. by UseVertices(params Vertex[])).

public Vertex(GeoPoint position)

Parameters

position GeoPoint

the position of the vertex

Vertex(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected Vertex(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Properties

AllEdges

The edges of this vertex as a new set (the same edges as Edges).

public HashSet<Edge> AllEdges { get; }

Property Value

HashSet<Edge>

Edges

Gets the list of edges of this vertex

public Edge[] Edges { get; }

Property Value

Edge[]

Faces

The faces for which a u/v position of this vertex has been cached (see GetPositionOnFace(Face)), which normally are the faces of its edges. Use InvolvedFaces to get the faces from the edges directly.

public Face[] Faces { get; }

Property Value

Face[]

InvolvedFaces

All faces that meet at this vertex, collected from the primary and secondary faces of its edges. A new set is created on each access.

public HashSet<Face> InvolvedFaces { get; }

Property Value

HashSet<Face>

Position

Gets the position of this vertex

public GeoPoint Position { get; }

Property Value

GeoPoint

Methods

ConditionalEdges(Predicate<Edge>)

Returns a list of all edges in this vertex that satisfy the provided condition.

public List<Edge> ConditionalEdges(Predicate<Edge> pr)

Parameters

pr Predicate<Edge>

The condition

Returns

List<Edge>

Edges that satisfy the condition

ConditionalEdgesSet(Predicate<Edge>)

Returns the edges of this vertex that satisfy the provided condition, as a set (see ConditionalEdges(Predicate<Edge>) for a list).

public HashSet<Edge> ConditionalEdgesSet(Predicate<Edge> pr)

Parameters

pr Predicate<Edge>

the condition

Returns

HashSet<Edge>

a new set with the edges that satisfy the condition

ConnectingEdges(Vertex, Vertex)

Returns the edges that connect v1 and v2, i.e. the edges that belong to both vertices. Usually there is at most one, but two faces may be connected by two different edges between the same vertices (e.g. the two halves of a circle).

public static IEnumerable<Edge> ConnectingEdges(Vertex v1, Vertex v2)

Parameters

v1 Vertex

the first vertex

v2 Vertex

the second vertex

Returns

IEnumerable<Edge>

the common edges, empty when the vertices are not connected

EdgesOnFace(Face)

Returns the edges of this vertex that belong to onThisFace (as primary or secondary face). Normally these are two edges: the one arriving at and the one leaving the vertex in the loop of the face.

public List<Edge> EdgesOnFace(Face onThisFace)

Parameters

onThisFace Face

the face

Returns

List<Edge>

the edges of the face at this vertex

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

GetObjectData(IJsonWriteData)

Writes this vertex for the JSON serialization (IJsonSerialize): its position and its edges (only the edges that belong to a face, since edges without faces cannot be restored).

public void GetObjectData(IJsonWriteData data)

Parameters

data IJsonWriteData

receives the properties

GetPositionOnFace(Face)

Returns the position of this vertex in the parameter (u/v) space of the surface of fc. The positions are cached per face: they are recorded when edges are attached and otherwise computed with PositionOf(GeoPoint) on first request. For a vertex on the seam of a periodic surface the recorded value is the one consistent with the 2d curves of the edges, which a plain projection might not give.

public GeoPoint2D GetPositionOnFace(Face fc)

Parameters

fc Face

the face

Returns

GeoPoint2D

the u/v position of the vertex on the face

SetObjectData(IJsonReadData)

Reads this vertex from the JSON serialization (IJsonSerialize), the counterpart of GetObjectData(IJsonWriteData).

public void SetObjectData(IJsonReadData data)

Parameters

data IJsonReadData

the properties to read

SingleConnectingEdge(Vertex, Vertex)

Returns an edge that connects v1 and v2, or null when there is none. When several edges connect the two vertices, an arbitrary one of them is returned (see ConnectingEdges(Vertex, Vertex)).

public static Edge SingleConnectingEdge(Vertex v1, Vertex v2)

Parameters

v1 Vertex

the first vertex

v2 Vertex

the second vertex

Returns

Edge

a connecting edge, or null