Table of Contents

Class Face

Namespace
CADability.GeoObject
Assembly
CADability.dll

A face is a finite piece of a surface. It is bounded by a SimpleShape in the 2-dimensional u/v space of the surface. A face is also a IGeoObject. The bounding curves of a face are implemented as Edges. If a face is contained in a Model it doesnt share its edges with other faces. If a face is part of a Shell (which maybe a part of a Solid) it shares some or all of its edges with other faces.

public class Face : IGeoObjectImpl, IGeoObject, ILayer, IStyle, IOctTreeInsertable, IComparable, IFeedBack, ICloneable, ISerializable, IColorDef, IDeserializationCallback, IJsonSerialize, IJsonSerializeDone, IExportStep
Inheritance
Face
Implements
Inherited Members
Extension Methods

Constructors

Face()

Creates an empty face without surface and edges. Not for direct use: call Construct(), which honours Constructor, and define the face afterwards.

protected Face()

Face(SerializationInfo, StreamingContext)

Constructor required by deserialization

protected Face(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

SerializationInfo

context StreamingContext

StreamingContext

Fields

Constructed

When set, this delegate is called at the end of every Face constructor (also during deserialization), e.g. to attach user data to each new face.

public static Face.ConstructedDelegate Constructed

Field Value

Face.ConstructedDelegate

Constructor

When set, Construct() calls this delegate instead of creating a Face, so that an application can substitute a derived class for every face CADability creates (also when reading files).

public static Face.ConstructionDelegate Constructor

Field Value

Face.ConstructionDelegate

OnPaintTo3D

Static hook called at the beginning of PaintTo3D(IPaintTo3D) for every face. Set it to replace or extend the way faces are displayed; when the handler returns true, the default painting of the surface and the edges is skipped. Null by default.

public static Face.PaintTo3DDelegate OnPaintTo3D

Field Value

Face.PaintTo3DDelegate

Properties

AllEdges

Returns all edges that surround this face (also the holes in this face)

public Edge[] AllEdges { get; }

Property Value

Edge[]

AllEdgesSet

All edges of this face (outline and holes) as a set. Unlike AllEdges a seam edge, which occurs twice in the outline of a face on a periodic surface, is contained only once. A new set is created on each call.

public HashSet<Edge> AllEdgesSet { get; }

Property Value

HashSet<Edge>

Area

Returns the two dimensional shape of the outline of this face in the parametric (u/v) space of the surface.

public SimpleShape Area { get; }

Property Value

SimpleShape

ColorDef

The color of this face, which is also used for its edges. When the face belongs to a Shell (or a Solid), setting the color changes this face only, but the change events are raised on the shell or solid, so that it is redrawn. The change is undoable.

public ColorDef ColorDef { get; set; }

Property Value

ColorDef

Description

Returns a textual description of the GeoObject. Mainly used for debugging purposes

public override string Description { get; }

Property Value

string

Domain

A bounding rectangle which restricts the parametric space of the Surface.

public BoundingRect Domain { get; }

Property Value

BoundingRect

Edges

Enumerates all edges of this face: first the edges of the outline, then the edges of each hole, in the order of the loops. Unlike AllEdges no array is created. A seam edge, which bounds the face on both sides, is returned twice.

public IEnumerable<Edge> Edges { get; }

Property Value

IEnumerable<Edge>

HoleCount

Gets the number of holes in this face.

public int HoleCount { get; }

Property Value

int

Name

The name of the face.

public string Name { get; set; }

Property Value

string

NameOrEmpty

The Name of this face, or an empty string when no name has been set (Name returns null then).

public string NameOrEmpty { get; }

Property Value

string

OrientedOutward

Returns the orientation of this face. this is only meaningful if this face is part of a closed shell which defines a solid. If true, the normal vector of the surface of this face points outward of the solid, if false it points into the inside.

public bool OrientedOutward { get; }

Property Value

bool

OutlineEdges

Gets all edges that represent the outline of this face (not the holes). The order of the edges is counterclockwise when you look at the face from the outside.

public Edge[] OutlineEdges { get; }

Property Value

Edge[]

OwnedItems

Returns an array of objects owned by this object. E.g. a face is owned by a shell.

public override IGeoObject[] OwnedItems { get; }

Property Value

IGeoObject[]

PreferredStyle

Returns the preferred style for this objects, see Style.EDefaultFor.

public override Style.EDefaultFor PreferredStyle { get; }

Property Value

Style.EDefaultFor

Surface

Returns the geometrical surface on which this face resides.

public ISurface Surface { get; }

Property Value

ISurface

Vertices

All vertices of this face, i.e. the start- and endpoints of its edges, each vertex once. They are collected from the edges on first access and cached; call RecalcVertices() after the edges have been changed. Do not modify the returned array.

public Vertex[] Vertices { get; }

Property Value

Vertex[]

Methods

CheckConsistency()

Checks the topological consistency of this face: the outline and each hole must be a closed loop of edges in which the end vertex of each edge is the start vertex of the next, each edge must refer to this face as its primary or secondary face, an edge shared with another face must be used in opposite directions by the two faces, and the 2d curves of the edges must run around the face in the correct direction and agree with the 3d curves. Intended for debugging and for validating imported or newly constructed faces.

public bool CheckConsistency()

Returns

bool

true if the face is consistent, false if a violation was found

Clone()

Clones this GeoObject.

public override IGeoObject Clone()

Returns

IGeoObject

the cloned GeoObject

Clone(Dictionary<Edge, Edge>, Dictionary<Vertex, Vertex>)

Clones this face so that several faces of a shell can be cloned with shared edges and vertices: an edge found in clonedEdges is reused and the clone becomes its second face, otherwise the edge is cloned and the pair original/clone is added to the dictionary; the same holds for the vertices. Used by Clone(Dictionary<Edge, Edge>, Dictionary<Vertex, Vertex>, Dictionary<Face, Face>). Pass empty dictionaries to clone a single face with new edges and vertices.

public Face Clone(Dictionary<Edge, Edge> clonedEdges, Dictionary<Vertex, Vertex> clonedVertices)

Parameters

clonedEdges Dictionary<Edge, Edge>

maps original edges to their clones, extended by this call

clonedVertices Dictionary<Vertex, Vertex>

maps original vertices to their clones, extended by this call

Returns

Face

the cloned face

ConnectTwoFaces(Face, Face, double)

Connect two faces by geometrically identical edges. Return true if at least one pair of edges has been combined (to a single edge). Doesn't combine singular edges.

public static bool ConnectTwoFaces(Face face1, Face face2, double precision)

Parameters

face1 Face
face2 Face
precision double

Returns

bool

Construct()

Creates an empty face, or an instance of the class Constructor provides. The face has no surface and no edges yet: define it with Set(ISurface, Edge[][], bool), or use one of the MakeFace methods (e.g. MakeFace(ISurface, SimpleShape)), which create and define a face in one step.

public static Face Construct()

Returns

Face

the new face

Contains(ref GeoPoint2D, bool)

Checks whether the provided 2d point in the parameter space of the surface is inside the bounds of this face. If the surface is periodic then it will also be checked whether the point with its periodic offset is contained in the face. In this case, the 2d coordinates of the point are updated to reflect the correct period in which it is inside the face

public bool Contains(ref GeoPoint2D p, bool acceptOnCurve)

Parameters

p GeoPoint2D

The point to check

acceptOnCurve bool

Also accept points on the outline

Returns

bool

true if the point is inside the face

CopyGeometry(IGeoObject)

Copies the geometrical aspects of the given GeoObject to this GeoObject. Both objects must be of the same type. The attributes are not copied.

public override void CopyGeometry(IGeoObject ToCopyFrom)

Parameters

ToCopyFrom IGeoObject

GeoObject to copy from

Distance(GeoPoint)

Returns the smallest distance from the provided point to the face. It will be the distance to a perpendicular footpoint on the face. If there is no such perpendicular footpoint double.MaxValue will be returned. This method does not compute the distance to edges or vertices. If you need those distances use PositionOf(GeoPoint) and PointAt(double).

public double Distance(GeoPoint fromHere)

Parameters

fromHere GeoPoint

Point from which the distance is calculated

Returns

double

The signed distance, positive is to the outside, negative to the inside

FindSnapPoint(SnapPointFinder)

Asks the object to add its snap points (end points, centres, intersections...) of the kinds that spf asks for. The default implementation adds none; objects with geometry override it.

public override void FindSnapPoint(SnapPointFinder spf)

Parameters

spf SnapPointFinder

definition and collection of the snap points

FreeCachedMemory()

Forwards FreeCachedMemory() to all edges of this face. Currently nothing is released; the triangulation of the face is kept.

public void FreeCachedMemory()

GetBoundingCube()

Returns a bounding cube of the object. The object must fir into this cube. There may be a smaller cube that contains the object if it is to expensive to calculate the exact cube.

public override BoundingCube GetBoundingCube()

Returns

BoundingCube

the bounding cube

GetExtent(Projection, ExtentPrecision)

Returns the 2d extent of the object as it appears in the given projection, in the coordinates of the projection's plane (not in pixels).

public override BoundingRect GetExtent(Projection projection, ExtentPrecision extentPrecision)

Parameters

projection Projection

the projection

extentPrecision ExtentPrecision

Exact for the exact extent, Raw for a quick estimate that may be larger

Returns

BoundingRect

the extent in the projection's 2d coordinates

GetExtent(double)

Gets the 3-dimensional extent of an object

public override BoundingCube GetExtent(double precision)

Parameters

precision double

Precision of the test

Returns

BoundingCube

The minmax cube

GetHashCode()

Internal use only

public override int GetHashCode()

Returns

int

GetInnerIntersection(Face)

Find inner intersection curves of two faces. This is only used to find intersection curves, which do not cross the edges of the faces. (but might also find and return such curves)

public ICurve[] GetInnerIntersection(Face other)

Parameters

other Face

the other face

Returns

ICurve[]

Array of inner intersection curves

GetLineIntersection(GeoPoint, GeoVector)

Intersects the infinite line through sp with direction direction with this face. Only the intersection points with the surface that lie inside the face (or on its border) are returned, in no particular order. Use GetOrientedLineIntersection(GeoPoint, GeoVector, out bool) when the line parameters and the orientation of the intersections are needed.

public GeoPoint[] GetLineIntersection(GeoPoint sp, GeoVector direction)

Parameters

sp GeoPoint

a point on the line

direction GeoVector

direction of the line

Returns

GeoPoint[]

the intersection points inside the face, empty when there are none

GetObjectData(IJsonWriteData)

Writes the data of this base class (user data, layer, style, user attributes and actuator) for the JSON serialization (IJsonSerialize). Derived classes override it, call the base implementation and add their own properties.

public override void GetObjectData(IJsonWriteData data)

Parameters

data IJsonWriteData

receives the data

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public override void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

receives the data

context StreamingContext

the destination of the serialization

GetOffset(double, Dictionary<Vertex, Vertex>)

Returns a face, that has the provided offset to this face. When dist>0 the offset will be to the outside, when dist<0, the offset will be to the inside Self intersection will not be checked.

public Face GetOffset(double dist, Dictionary<Vertex, Vertex> vertices)

Parameters

dist double

the offset distance

vertices Dictionary<Vertex, Vertex>

maps each vertex of this face to the already created vertex of the offset face, which is used for the edges of the resulting face, so that adjacent offset faces share their vertices

Returns

Face

GetOrientedLineIntersection(GeoPoint, GeoVector, out bool)

Intersects this face with the infinite line through sp with the given direction. For each intersection point inside the face, the result contains the line parameter (sp + par*direction) and whether the line leaves the face in the direction of the surface normal (true) or enters it against the normal (false). isBoundaryCase is set when an intersection point lies on the border of the face or the line is (almost) tangential to the surface there: then the result is not reliable for an inside/outside test.

public List<(double, bool)> GetOrientedLineIntersection(GeoPoint sp, GeoVector direction, out bool isBoundaryCase)

Parameters

sp GeoPoint
direction GeoVector
isBoundaryCase bool

Returns

List<(double, bool)>

GetPeriodicalConnected()

Returns all other directly connected faces which have a common ISurfaceOfArcExtrusion surface

public HashSet<Face> GetPeriodicalConnected()

Returns

HashSet<Face>

GetPlaneIntersection(PlaneSurface)

Returns the curves that result from a planar intersection of this face with the provided plane. The curves are clipped to the outline (and holes) of the face.

public ICurve[] GetPlaneIntersection(PlaneSurface pl)

Parameters

pl PlaneSurface

The plane to intersect with

Returns

ICurve[]

Array of intersection curves

GetQuadTreeItem(Projection, ExtentPrecision)

Returns an item for a 2d quad tree of the projected objects, used for hit tests in a projection: it knows the 2d extent of the object, whether a 2d rectangle hits it, and the depth (z position) of the object at a 2d point. Composite objects (blocks, solids, paths) return a collection of the items of their parts.

public override IQuadTreeInsertableZ GetQuadTreeItem(Projection projection, ExtentPrecision extentPrecision)

Parameters

projection Projection

the projection

extentPrecision ExtentPrecision

precision of the extent, see GetExtent(Projection, ExtentPrecision)

Returns

IQuadTreeInsertableZ

the item for the quad tree

GetSameSurfaceConnected()

Returns the faces which share an outline edge with this face and lie on the same surface (see SameSurface(Face)), e.g. the parts of a cylinder that has been split at its seam. Faces connected only via a hole edge are not considered. The result does not contain this face and is empty when there is no such neighbour.

public IEnumerable<Face> GetSameSurfaceConnected()

Returns

IEnumerable<Face>

the directly connected faces on geometrically identical surfaces

GetShadow(Plane)

Returns the shadow of this face when it is projected perpendicularly onto onThisPlane: a SimpleShape in the 2d coordinate system of the plane. A face that folds over in the projection is split at its silhouette first and the shadows of the parts are united. Returns null when the face is seen edge-on (its projection has no area) or when the shadow could not be computed.

public SimpleShape GetShadow(Plane onThisPlane)

Parameters

onThisPlane Plane

the plane to project onto

Returns

SimpleShape

the outline (and holes) of the shadow, or null

GetShowProperties(IFrame)

Should be overridden and return a IPropertyEntry derived object that handles the display and modification of the properties of the IGeoObject derived object. Default implementation return null.

public override IPropertyEntry GetShowProperties(IFrame Frame)

Parameters

Frame IFrame

Returns

IPropertyEntry

GetSimpleTriangulation(double, bool, out GeoPoint[], out GeoPoint2D[], out int[], out int[])

Computes a triangulation of this face without using or filling the cached triangulation (see GetTriangulation(double, out GeoPoint[], out GeoPoint2D[], out int[], out BoundingCube)). The points of the boundary polygons come first in trianglePoint and triangleUVPoint: edgeIndizes holds, for the outline and for each hole, the index following its last point, so the points of loop i are those from edgeIndizes[i-1] (0 for the first loop) to edgeIndizes[i]-1. All arrays are empty when the outline of the face has no area.

public void GetSimpleTriangulation(double precision, bool noInnerPoints, out GeoPoint[] trianglePoint, out GeoPoint2D[] triangleUVPoint, out int[] triangleIndex, out int[] edgeIndizes)

Parameters

precision double

maximum deviation of the polygons from the edges; the triangles inside the face may deviate from the surface by about five times this value, as in GetTriangulation(double, out GeoPoint[], out GeoPoint2D[], out int[], out BoundingCube)

noInnerPoints bool

true: the boundary polygons are triangulated as they are; false: triangles whose edges deviate too much from the surface are subdivided, which adds points inside the face

trianglePoint GeoPoint[]

the 3d points of the triangles

triangleUVPoint GeoPoint2D[]

the same points in the u/v system of the surface

triangleIndex int[]

three indices per triangle into the point arrays

edgeIndizes int[]

for each loop (outline, holes) the index following its last point

GetTriangulation(double, out GeoPoint[], out GeoPoint2D[], out int[], out BoundingCube)

Returns the triangulation of this face to the provided precision: the edges are approximated within precision, the triangles inside the face may deviate from the surface by about five times precision, because the display does not need more. To keep the deviation inside the face close to a value, pass a fifth of it (the triangulation checks a few points per triangle, so this is not a strict bound). The triangulation is cached and reused for every later request down to half the precision it was made with, so it may be up to twice as coarse as requested; a fresh copy of the face (Clone()) is triangulated anew. trianglePoint and triangleUVPoint are two arrays of the same length specifying the vertices of the triangle in 3d or 2d surface coordinates. triangleIndex is a list of indizes to trianglePoint and triangleUVPoint where each triple of indices describes one triangle. The length of triangleIndex is a multiple of 3.

public void GetTriangulation(double precision, out GeoPoint[] trianglePoint, out GeoPoint2D[] triangleUVPoint, out int[] triangleIndex, out BoundingCube triangleExtent)

Parameters

precision double

Maximum deviation of the edges, a fifth of the deviation allowed inside the face

trianglePoint GeoPoint[]

Resulting 3d points

triangleUVPoint GeoPoint2D[]

Resulting 2d points

triangleIndex int[]

Triangle indizes

triangleExtent BoundingCube

Extent of the triangles

GetUVBounds()

Returnes the minimum and maximum values of coordinates in the parametric space used by this face.

public BoundingRect GetUVBounds()

Returns

BoundingRect

Extent in parametric space (u/v)

GetUVBounds(out double, out double, out double, out double)

Returnes the minimum and maximum values of coordinates in the parametric space used by this face.

public void GetUVBounds(out double umin, out double umax, out double vmin, out double vmax)

Parameters

umin double

Minimum in u direction

umax double

Maximum in u direction

vmin double

Minimum in v direction

vmax double

Maximum in v direction

GetUVOutline(double)

Returns the boundary of this face in the parameter (u/v) space of its surface as closed polygons: the first polygon is the outline, the following polygons are the holes. The edges are approximated so that the polygons deviate at most precision from the exact curves; the first point of a polygon is not repeated at its end. Returns an empty array when the outline degenerates (has no area).

public GeoPoint2D[][] GetUVOutline(double precision)

Parameters

precision double

maximum deviation of the polygons from the edges

Returns

GeoPoint2D[][]

the outline and the holes as polygons in the u/v system

HitBoundingCube(BoundingCube)

Tests whether this face interferes with the cube bc: true if a vertex of the face lies in the cube, an edge passes through it, or the surface passes through the cube at a point inside the face. The test is exact, it does not use the triangulation. HitTest(ref BoundingCube, double) is the general entry point for this test.

public bool HitBoundingCube(BoundingCube bc)

Parameters

bc BoundingCube

the cube to test

Returns

bool

true if face and cube have a point in common

HitBoundingCube(BoundingCube, BoundingCube)

Same as HitBoundingCube(BoundingCube). fbc, the extent of this face, was once used for a shortcut that is now disabled and is ignored.

public bool HitBoundingCube(BoundingCube bc, BoundingCube fbc)

Parameters

bc BoundingCube

the cube to test

fbc BoundingCube

the bounding cube of this face, not used

Returns

bool

true if face and cube have a point in common

HitTest(ref BoundingCube, double)

Tests whether an object is touched by the provided cube

public override bool HitTest(ref BoundingCube cube, double precision)

Parameters

cube BoundingCube

To test with

precision double

Required precision

Returns

bool

true if the object strikes the cube

HitTest(Projection, BoundingRect, bool)

Tests whether an object is inside or touched by the rectangle when projected with the provided projection

public override bool HitTest(Projection projection, BoundingRect rect, bool onlyInside)

Parameters

projection Projection

The projection for the test

rect BoundingRect

The rectangle to test the position

onlyInside bool

true: the object must be totaly inside the rectangle, false: the object must be totaly or partially inside the rectangle

Returns

bool

true when the test succeedes, false otherwise

HitTest(PickArea, bool)

Tests whether an object is inside or touched by the provided area

public override bool HitTest(Projection.PickArea area, bool onlyInside)

Parameters

area Projection.PickArea

The area to check for

onlyInside bool

true: the object must be totaly inside the area, false: the object must be totaly or partially inside the area

Returns

bool

true when the test succeedes, false otherwise

HoleEdges(int)

Returns all edges that belong to the hole with the provided index. The order of the edges is counterclockwise when you look at the face from the outside.

public Edge[] HoleEdges(int index)

Parameters

index int

Index of the hole to get

Returns

Edge[]

The requested hole

Intersect(Face)

[Obsolete("Has been renamed to \"GetInnerIntersection\"")]
public ICurve[] Intersect(Face other)

Parameters

other Face

the other face

Returns

ICurve[]

the inner intersection curves

IsClosedSurface()

Returns true if this face together with a tangentially connected neighbour on the same surface forms a closed (full periodic) surface, like the two halves of a cylinder that has been split at its seam. The test is heuristic: it looks for a neighbour with the same surface that shares at least two outline edges with this face. Only faces on a cylindrical or toroidal surface (ISurfaceOfArcExtrusion) are considered, for all other faces the result is false.

public bool IsClosedSurface()

Returns

bool

true if this face is a part of a closed surface

IsConnectedWith(Face)

Returns true if this face and fc1 share an edge (of the outline or of a hole), i.e. are direct neighbours.

public bool IsConnectedWith(Face fc1)

Parameters

fc1 Face

the other face

Returns

bool

true if there is a common edge

IsFillet()

Returns true, if this face can be considered as a fillet between two other faces

public bool IsFillet()

Returns

bool

MakeFace(GeoObjectList)

Try to make a Face from the provided objects, using the curves to make a planar face

public static Face MakeFace(GeoObjectList list)

Parameters

list GeoObjectList

the objects to make the face from, the curves in this list must form a single closed planar outline

Returns

Face

MakeFace(ISurface, BoundingRect)

Creates a face on surface bounded by the rectangle br in the parameter (u/v) space of the surface, e.g. a rectangular patch of a plane or a segment of a cylinder. The rectangle also becomes the used area of the surface. The edges of the face are new and belong only to this face.

public static Face MakeFace(ISurface surface, BoundingRect br)

Parameters

surface ISurface

the surface of the face

br BoundingRect

the bounds in the u/v system of the surface

Returns

Face

the created face

MakeFace(ISurface, SimpleShape)

Creates a face by specification of the geometrical surface and the outline in the parametric space on that surface.

public static Face MakeFace(ISurface surface, SimpleShape outline)

Parameters

surface ISurface

The surface

outline SimpleShape

The outline

Returns

Face

The created face

MakeFace(ISurface, List<List<ICurve2D>>)

Creates a face on surface from 2d curves in its parameter (u/v) space. The first list is the outline, each further list a hole. The curves of each list must form a closed loop in the given order, the outline counterclockwise, the holes clockwise; this is not checked. The 3d curves of the edges are computed from the surface, the new edges belong only to this face.

public static Face MakeFace(ISurface surface, List<List<ICurve2D>> outlineAndHoles)

Parameters

surface ISurface

the surface of the face

outlineAndHoles List<List<ICurve2D>>

the outline followed by the holes, each as a loop of 2d curves on the surface

Returns

Face

the created face

MakeFace(GeoPoint, GeoPoint, GeoPoint)

Creates a new face representing a tringle in space

public static Face MakeFace(GeoPoint p1, GeoPoint p2, GeoPoint p3)

Parameters

p1 GeoPoint
p2 GeoPoint
p3 GeoPoint

Returns

Face

MakePlanarFace(IGeoObject[])

Creates a face by connecting curves. The objects in bounds must describe a closed border which may contain some holes.

public static Face MakePlanarFace(IGeoObject[] bounds)

Parameters

bounds IGeoObject[]

Returns

Face

MakeRegularSurface(double)

PRELIMINARY! Tries to use a more simple surface for this face. E.g. a NurbsSurface will be reduced to a torodial surface if the data allows it. The followind replacements are currently performed

public bool MakeRegularSurface(double maxError)

Parameters

maxError double

The maximum aberration of the surfaces

Returns

bool

true if surface could be simplyfied

Modify(ModOp)

Modifies this GeoObject with the given modification operation (includes moving, rotating, reflecting, scaling etc.).

public override void Modify(ModOp m)

Parameters

m ModOp

Operation to be applied

ModifySurface(ISurface, ModOp2D)

Replaces the surface of this face by (a clone of) surface, which must have the same geometry but may use a different parameterization (e.g. a NurbsSurface replaced by the CylindricalSurface it describes). reparameterize maps the u/v system of the old surface to the one of the new surface; the 2d curves of all edges on this face are transformed accordingly, the 3d curves are kept, and edges with an InterpolatedDualSurfaceCurve are rebuilt on the new surface.

public void ModifySurface(ISurface surface, ModOp2D reparameterize)

Parameters

surface ISurface

the new surface, geometrically identical to the old one

reparameterize ModOp2D

transformation from the old to the new u/v system

ModifySurface(ModOp)

Applies m to the surface (and to the cached triangulation) of this face only. The edges are not modified, so the face is inconsistent until the caller has modified them too; Modify(ModOp) does both and is what normally should be used. Used by Shell, which modifies its shared edges separately. Raises the change events, but is not undoable.

public void ModifySurface(ModOp m)

Parameters

m ModOp

the modification

PaintTo3D(IPaintTo3D)

Paints the object with the methods of paintTo3D: lines, triangles, text... The views implement IPaintTo3D (with OpenGL or GDI) and collect what the object paints in a display list, so this is called rarely, after PrepareDisplayList(double) has done the expensive work (triangulation, approximation).

public override void PaintTo3D(IPaintTo3D paintTo3D)

Parameters

paintTo3D IPaintTo3D

where to paint

PaintTo3DList(IPaintTo3D, ICategorizedDislayLists)

Adds this object as a whole to the display lists, in the category of its layer. Suitable for simple objects like curves and text; composite objects (solids, shells, blocks) override it and add their parts by category.

public override void PaintTo3DList(IPaintTo3D paintTo3D, ICategorizedDislayLists lists)

Parameters

paintTo3D IPaintTo3D

the paint interface of the view

lists ICategorizedDislayLists

the display lists to add to

Position(GeoPoint, GeoVector, double)

Returns the smallest parameter value (l) where the provided line hits the object so that the point fromHere + l * direction is on or close to the object. The result may be negative. Return double.MaxValue if there is no such point.

public override double Position(GeoPoint fromHere, GeoVector direction, double precision)

Parameters

fromHere GeoPoint

Startpoint of the line

direction GeoVector

Direction of the line

precision double

Precision for the test

Returns

double

Position on the line

PositionOf(GeoPoint)

Gets the Surface.PositionOf(p) in the correct periodic domain

public GeoPoint2D PositionOf(GeoPoint p)

Parameters

p GeoPoint

Returns

GeoPoint2D

PrepareDisplayList(double)

Called before PaintTo3D(IPaintTo3D) is called, should implement the time consuming work for the display (like calculationg the triangulation of Faces or Polylines of Curves). Not normally used by user code.

public override void PrepareDisplayList(double precision)

Parameters

precision double

Required precision

RecalcVertices()

Recollects the vertices of this face from its edges (see Vertices). Needed after edges have been replaced or their vertices have been merged, because the vertices are cached.

public void RecalcVertices()

RemoveHole(int)

Removes the hole with the given index (see HoleEdges(int)) from this face, so that the face covers the area of the hole again. The edges of the hole are no longer part of this face and their vertices are removed from the vertices of the face. The change is undoable and raises the change events.

public void RemoveHole(int holeIndex)

Parameters

holeIndex int

index of the hole to remove, 0 <= holeIndex < HoleCount

ReverseOrientation()

Reverses the orientation of this Face. the normal vector on any point of the surface will point to the opposite direction

public void ReverseOrientation()

SameForm(Face[], Face[], double, out ModOp)

Tests whether two sets of faces have the same shape and differ only by a translation: for each face in faces1 there must be a face in faces2 with the same surface and the same outline after faces2 has been moved by translation. Note that the faces in faces2 are actually moved by the translation as a side effect of the test and are not moved back. See also SameForm(Shell, double, out ModOp) and FindSameForm(Face[], double, FindSameFormSearchMode).

public static bool SameForm(Face[] faces1, Face[] faces2, double precision, out ModOp translation)

Parameters

faces1 Face[]

the first set of faces

faces2 Face[]

the second set of faces, which gets translated

precision double

maximum deviation still accepted as equal

translation ModOp

the translation that moves the center of the extent of faces2 onto the center of the extent of faces1 (the identity when the arrays differ in length)

Returns

bool

true if the two sets have the same form

SameSurface(Face)

Returns true, when the otherFace has a geometrically equal surface

public bool SameSurface(Face otherFace)

Parameters

otherFace Face

Returns

bool

Set(ISurface, Edge[][], bool)

Defines a face created with Construct(): sets its surface and its edges. Each array in edges is a closed loop of edges, which must already refer to this face with their 2d curves (see SetFace(Face, ICurve2D, bool)); the loop with the largest extent in the u/v system of the surface becomes the outline, all other loops become holes. The face becomes the owner of the edges, and the used area of the surface is set to the domain of the face.

public void Set(ISurface surface, Edge[][] edges, bool checkOutline = false)

Parameters

surface ISurface

the surface of the face

edges Edge[][]

the loops of edges, one of them the outline, the others holes

checkOutline bool

true: the 2d curves of each loop are checked and, where necessary, reversed or shifted by the period of the surface so that they form a connected loop (needed for edges from an import, where direction and periodic position of the 2d curves are not reliable)

SetArea(SimpleShape)

Replaces the edges of this face by new edges made from the 2d shape outline in the parameter space of the current surface (one edge per curve of the outline and of each hole). Only used while a face is being constructed.

protected virtual void SetArea(SimpleShape outline)

Parameters

outline SimpleShape

the outline and holes in the u/v system of the surface

SetObjectData(IJsonReadData)

Reads the data written by GetObjectData(IJsonWriteData) back from the JSON serialization. Derived classes override it, call the base implementation and read their own properties. Objects referenced by the data may still be incomplete at this time, see IJsonSerializeDone.

public override void SetObjectData(IJsonReadData data)

Parameters

data IJsonReadData

provides the data

SetSurface(ISurface)

Sets the surface of this face without touching its edges and resets the cached extent. Only used while a face is being constructed: the edges must be set afterwards to match the surface.

protected virtual void SetSurface(ISurface surface)

Parameters

surface ISurface

the surface

SplitPeriodicFace()

Splits a face on a periodic surface (e.g. a full cylinder or torus) that contains a seam edge, i.e. an outline edge which bounds the face on both sides, into faces without seams. The face is split across the middle of its domain, perpendicular to the seam. The resulting faces are new objects with their own edges; this face is not modified. Returns null when the surface is not periodic or the outline has no seam edge. Boolean operations work better without seams, see SplitPeriodicFaces().

public List<Face> SplitPeriodicFace()

Returns

List<Face>

the parts of the face, or null when there is nothing to split

SplitSingularFace()

Splits a face whose surface has a singularity (a pole, like the apex of a cone or the poles of a sphere) inside its domain along the parameter lines through the singularity, so that the singularity lies on the border of each resulting face. The resulting faces are new objects with their own edges; this face is not modified. Returns null when the surface has no singularities or none of them is inside the face.

public List<Face> SplitSingularFace()

Returns

List<Face>

the parts of the face, or null when there is nothing to split

UseEdge(Edge)

Tries to use the provided edge if this face has a geometrical identical edge

public bool UseEdge(Edge toUse)

Parameters

toUse Edge

Returns

bool

true, if edge was replaced