Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Fiber::TriangularSurface Struct Reference

A triangular surface stored on a Grid. More...

#include <TriangularSurface.hpp>

Inheritance diagram for Fiber::TriangularSurface:
Eagle::StrongPtr< Object, ObjectBase > MemCore::WeakPtr< Object, ObjectBase > MemCore::DynPtr< Object, ObjectBase > Fiber::TriangularSurfaceWithEdges

Public Types

typedef MemArray< 1, Eagle::PhysicalSpace::pointCoordsArray_t
typedef MultiArray< 1, Eagle::PhysicalSpace::pointCoordsArray_m_t
typedef MemArray< 1, TriangleCell_t > CellArray_t
typedef MultiArray< 1, TriangleCell > CellArray_m_t
typedef CellArray_t ConnectivityArray_t
typedef CellArray_t TriangleArray_t
typedef MemArray< 1, Eagle::PhysicalSpace::bivectorNormalVectorArray_t
typedef MultiArray< 1, Eagle::PhysicalSpace::bivectorNormalVectorArray_m_t
Public Types inherited from Eagle::StrongPtr< Object, ObjectBase >
typedef WeakPtr< Object, ObjectBase >::ObjectBase_t ObjectBase_t
Public Types inherited from MemCore::WeakPtr< Object, ObjectBase >
typedef Object object_t
typedef ObjectBase ObjectBase_t
typedef RefPtrTypeTrait< Object, ObjectBase >::ReferencePointerType pointer_t
typedef RefPtrTypeTrait< Object, ObjectBase >::ReferenceValueType refvalue_t
Public Types inherited from MemCore::DynPtr< Object, ObjectBase >
typedef Object object_t

Public Member Functions

 TriangularSurface (const RefPtr< Grid > &=NullPtr())
 Construct a triangular surface from a Grid object, extracting those properties that make a triangular surface.
TriangularSurfaceoperator= (const RefPtr< Grid > &)
 ~TriangularSurface ()
 Destructor.
RefPtr< CreativeArrayBasenewVertexNormalCreator () const
RefPtr< FieldgetVertexNormalField (const string &FieldName=NormalVectorFieldName)
 Get normal vectors, possibly computing them if they do not exist yet.
RefPtr< NormalVectorArray_t > getVertexNormals (const string &FieldName=NormalVectorFieldName)
RefPtr< CoordsArray_t > getCoords () const
 Get the coordinate data array.
RefPtr< CellArray_t > getCells () const
 Get the triangle data array.
template<int N, class T>
RefPtr< Fiber::MemBasegetTriangularFieldData (const std::string &fieldname, RefPtr< FragmentID > fragID=NullPtr())
RefPtr< CoordsArray_t > getNormals (const string &FieldName=NormalVectorFieldName)
RefPtr< FieldgetTriangleBaryCenters ()
LineSet OutLines (const RefPtr< Grid > &OutputGrid)
 Compute the outlines of this triangular surface.
Public Member Functions inherited from Eagle::StrongPtr< Object, ObjectBase >
StrongPtrassignStrong (const DynPtr_t &other)
StrongPtrassignStrong (const ReferenceBase< ObjectBase_t > *Obj)
StrongPtrassignStrong (const std::nullptr_t &)
auto operator() (Arguments...parameters) const -> decltype((*this->getPtrValue())(parameters...))
refvalue_toperator* () const
pointer_t operator-> () const
StrongPtroperator= (const DynPtr_t &other)
StrongPtroperator= (const ReferenceBase< ObjectBase_t > *Obj)
StrongPtroperator= (const std::initializer_list< StrongPtr > &other)
StrongPtroperator= (const std::nullptr_t &)
StrongPtroperator= (const StrongPtr &other)
auto operator[] (const IndexType &I) const -> decltype((*this->getPtrValue())[I])
 StrongPtr (const ReferenceBase< ObjectBase_t > *Obj)
 StrongPtr (const ReferenceBase< ObjectBase_t > *Obj, const NotNullPtr &)
 StrongPtr (const std::nullptr_t &)
 StrongPtr (const StrongPtr< ChildObject, ObjectBase > &Other)
 StrongPtr (const StrongPtr< Object, ObjectBase > &Other)
 StrongPtr (const WeakPtr< ChildObject, ObjectBase_t > &Other)
Public Member Functions inherited from MemCore::WeakPtr< Object, ObjectBase >
 WeakPtr (const std::nullptr_t &)
 WeakPtr (const ReferenceBase< ObjectBase > *Obj)
 WeakPtr (const ReferenceBase< ObjectBase > *Obj, const NotNullPtr &)
 WeakPtr (const WeakPtr< AnyObject, ObjectBase > &Other)
 WeakPtr (const WeakPtr &Other)
pointer_t getPtrValue () const
pointer_t operator-> () const
refvalue_toperator* () const
size_t operator~ () const
WeakPtrassignWeak (const WeakPtr &other)
WeakPtroperator= (const WeakPtr &other)
Public Member Functions inherited from MemCore::DynPtr< Object, ObjectBase >
const DynPtrgetDynPtr () const noexcept
const type_info & getType () const noexcept
bool isAssignable (const DynPtr< ObjectBase, ObjectBase > &Other) const noexcept
 operator void * () const noexcept
bool operator! () const noexcept
void speak (const char *s, const char *prefix="") const noexcept
void Speak (const char *s, const char *prefix="") const

Static Public Member Functions

static bool addVerticesAndConnectivity (Grid &G, const RefPtr< CoordsArray_t > &Vertices, const RefPtr< CellArray_t > &Connectivity)
 Add Vertices& Connectivity to grid.
static Eagle::PhysicalSpace::bivector NormalVector (const TriangleCell &T, const MultiArray< 1, Eagle::PhysicalSpace::point > &Vertices)
 Compute the normal vector of a triangle.
static RefPtr< NormalVectorArray_t > computeVertexNormals (const RefPtr< CoordsArray_t > &Pts, const RefPtr< CellArray_t > &Cells, const MemBase::Creator_t &Crec=NullPtr())
static SkeletonID ID ()
 2D objects of index depth 1 .
static RefPtr< SkeletongetFaceSkeleton (const RefPtr< Grid > &G, bool CreateIfNotFound)
 Get the Skeleton holding the Faces (two-dimensional k-cells) of the given Grid object.
static TriangularSurface create (Grid &theGrid, const RefPtr< MemBase > &Vertices, const RefPtr< MemBase > &Triangles, bool DiscardableVertices, bool DiscardableTriangles)
static TriangularSurface create (Grid &theGrid, const RefPtr< MemBase > &Vertices, const RefPtr< MemBase > &Triangles, bool Discardable=false)
static RefPtr< CoordsArray_t > computeBaryCenters (const RefPtr< CoordsArray_t > &Pts, const RefPtr< CellArray_t > &Cells, const MemBase::Creator_t &Crec=NullPtr())
static RefPtr< CoordsArray_t > computeCircumCircleCenter (const RefPtr< CoordsArray_t > &Pts, const RefPtr< CellArray_t > &Cells, const MemBase::Creator_t &Crec=NullPtr())
static RefPtr< CoordsArray_t > computeInCircleCenter (const RefPtr< CoordsArray_t > &Pts, const RefPtr< CellArray_t > &Cells, const MemBase::Creator_t &Crec=NullPtr())
static bool containtedEdgeInArray (uint32_t A, uint32_t B, const std::vector< Edges::EdgeCell_t > &edges)
static void addIfEdgeOfNotContained (const Edges::EdgeCell_t &edge, std::vector< Edges::EdgeCell_t > &edges)
static RefPtr< LineSet::LinesetArray_tcomputeOutLinesViaTriangles (const RefPtr< CoordsArray_t > &Pts, const RefPtr< CellArray_t > &Cells, const MemBase::Creator_t &Crec=NullPtr())
Static Public Member Functions inherited from MemCore::DynPtr< Object, ObjectBase >
static const DynPtrgetNullPtr () noexcept

Public Attributes

RefPtr< FieldCoordField
 Field for the vertex coordinates.
RefPtr< FieldVertexNormalField
 internal storage of the vertex normal field if existent Use getVertexNormalField() to compute the normals, if required
RefPtr< FieldCellField
 Field for the triangle indices.
RefPtr< RepresentationCartesianVertices
 Collection of all fields given on vertices relative to cartesian coordinates.
RefPtr< RepresentationCellsAsVertices
 Collection of all fields given on triangles.

Static Public Attributes

static const char NormalVectorFieldName [] = "Normals"
 A default name for the field that holds the normal vectors of a grid with a surface.

Additional Inherited Members

Protected Member Functions inherited from MemCore::WeakPtr< Object, ObjectBase >
 WeakPtr (Object *that, const SelfInitialize &)
Protected Member Functions inherited from MemCore::DynPtr< Object, ObjectBase >
 DynPtr (const DynPtr< AnyObject, ObjectBase > &Other) noexcept
 DynPtr (const std::nullptr_t &) noexcept

Detailed Description

A triangular surface stored on a Grid.

The information required in a Grid object are vertices given in cartesian coordinates, and triangles given as indices of three vertices per triangle index. This information defines two arrays, of type CoordsArray_t and of type CellArray_t.

The Grid must carry Vertices in Cartesian coordinates and a (2,1) Skeleton with positions in the Vertices as triangle cells.

A Grid object can be easily tested whether it is ("conforms to the concept of") a TriangularSurface:

if (TriangularSurface T = G)
{
... yes is a triangular surface ...
}
StrongPtr< Object, ObjectBase > RefPtr
TriangularSurface(const RefPtr< Grid > &=NullPtr())
Construct a triangular surface from a Grid object, extracting those properties that make a triangular...
Definition TriangularSurface.cpp:17

If the reason for not being a TriangularSurface need to be inspected further, then the members of the TriangularSurface can be investigated.

Todo
Compute area, curvature, ... http://en.wikipedia.org/wiki/Barycentric_coordinates_%28mathematics%29
Examples
CrystalSurface.cpp, EvolutionSurface.cpp, MonochromeSurface.cpp, PolychromeSurface.cpp, TransparentColoredSurface.cpp, and TransparentSurface.cpp.

Constructor & Destructor Documentation

◆ TriangularSurface()

Fiber::TriangularSurface::TriangularSurface ( const RefPtr< Grid > & G = NullPtr())

Construct a triangular surface from a Grid object, extracting those properties that make a triangular surface.

Note that the Grid pointer (the base class) will not be assigned if the given Grid does not conform to the properties of a Triangular Surface, thus the evaluation will return false. A valid code to check if a Grid is a triangular surface looks like this:

RefPtr<Grid> G = ...
if (TriangularSurface T = G )
{
// yes, it's a triangular surface
}

This is a mere cmeta-data check for the existence of appropriate Fields. The triangular surface will still be invalid if there are no data associated in those Fields. This meta-data check does not load or create any data.

References CartesianVertices, CellField, CellsAsVertices, CoordField, NormalVectorFieldName, Eagle::StrongPtr< Object, ObjectBase >::operator=(), and VertexNormalField.

Referenced by Fiber::TriangularSurfaceWithEdges::TriangularSurfaceWithEdges(), Fiber::TriangularSurfaceWithEdges::create(), Fiber::TriangularSurfaceWithEdges::createEdgesPerVertex(), Fiber::TriangularSurfaceWithEdges::createTrianglesPerEdge(), Fiber::TriangularSurfaceWithEdges::createTrianglesPerTriangle(), and Fiber::TriangularSurfaceWithEdges::createTrianglesPerVertex().

Member Function Documentation

◆ addVerticesAndConnectivity()

bool Fiber::TriangularSurface::addVerticesAndConnectivity ( Grid & G,
const RefPtr< CoordsArray_t > & Vertices,
const RefPtr< CellArray_t > & Connectivity )
static

Add Vertices& Connectivity to grid.

Add Position to grid.

Author
: doeby

Set Vertices

Set Connectivity

References Fiber::SkeletonMap::findVertices(), ID(), Fiber::Grid::makeCartesianRepresentation(), and Fiber::Representation::setPositions().

◆ getCells()

RefPtr< CellArray_t > Fiber::TriangularSurface::getCells ( ) const
inline

Get the triangle data array.

The surface must be unfragmented.

References CellField.

Referenced by OutLines(), and Fiber::SplitMeshEdges().

◆ getCoords()

RefPtr< CoordsArray_t > Fiber::TriangularSurface::getCoords ( ) const
inline

Get the coordinate data array.

The surface must be unfragmented.

References CoordField.

Referenced by OutLines().

◆ getVertexNormalField()

RefPtr< Field > Fiber::TriangularSurface::getVertexNormalField ( const string & FieldName = NormalVectorFieldName)

Get normal vectors, possibly computing them if they do not exist yet.

Access VertexNormalField to see if this field already has been defined.

References CartesianVertices, and VertexNormalField.

◆ ID()

SkeletonID Fiber::TriangularSurface::ID ( )
inlinestatic

2D objects of index depth 1 .

Return a skeleton ID that is characteristic for this type of Grids. In this case, for a set of triangles, it will be the (2,1) skeleton, with 2D cells referring to vertices.

Examples
PolychromeSurface.cpp, TransparentColoredSurface.cpp, and TransparentSurface.cpp.

Referenced by addVerticesAndConnectivity(), and getFaceSkeleton().

Member Data Documentation

◆ NormalVectorFieldName

const char Fiber::TriangularSurface::NormalVectorFieldName = "Normals"
static

A default name for the field that holds the normal vectors of a grid with a surface.

It will just be "Normals";

Examples
ComputeNormals.cpp.

Referenced by TriangularSurface(), Wizt::TriangleRenderer::computeVertexNormals(), and Wizt::TriangleRenderer::getNormals().