25#ifndef _MODELS_VERTEX_SOLVER_TFVERTEX_H_
26#define _MODELS_VERTEX_SOLVER_TFVERTEX_H_
31#include <rendering/tfStyle.h>
36#include <io/tfThreeDFVertexData.h>
41namespace TissueForge::models::vertex {
56 std::memcpy(this->name,
"MeshParticleType",
sizeof(
"MeshParticleType"));
57 style->setVisible(
false);
58 dynamics = PARTICLE_OVERDAMPED;
80 std::vector<Surface*> surfaces;
83 FloatP_t _particleMass;
92 std::vector<Vertex*> _connectedVertices;
125 static std::vector<VertexHandle>
create(
const std::vector<unsigned int>& _pids);
132 static std::vector<VertexHandle>
create(
const std::vector<FVector3>& positions);
139 static std::vector<VertexHandle>
create(
const std::vector<TissueForge::io::ThreeDFVertexData*>& vdata);
142 MESHBOJ_DEFINES_DECL(
Body);
143 MESHOBJ_CLASSDEF(MeshObjTypeLabel::VERTEX)
148 std::
string str() const;
153 std::
string toString();
211 const
int getPartId()
const {
return pid; }
221 const std::vector<Surface*>&
getSurfaces()
const {
return surfaces; }
386 static HRESULT merge(
const std::vector<std::vector<Vertex*> >& toMerge,
const FloatP_t &lenCf=0.5f);
773 operator bool()
const {
return id >= 0; }
796 os << o.
str().c_str();
805 return hash<int>()(h.id);
The mesh body is a volume-enclosing object of mesh surfaces.
Definition tfBody.h:59
Contains all Vertex, Surface and Body instances.
Definition tfMesh.h:52
The mesh surface is an area-enclosed object of implicit mesh edges defined by mesh vertices.
Definition tfSurface.h:65
The mesh vertex is a volume of a mesh centered at a point in a space.
Definition tfVertex.h:71
static std::vector< VertexHandle > create(const std::vector< unsigned int > &_pids)
Create vertices.
HRESULT replace(Body *toReplace)
Replace a body.
const std::vector< Surface * > & getSurfaces() const
Get the surfaces defined by the vertex.
Definition tfVertex.h:221
Vertex * splitExecute(const FVector3 &sep, const std::vector< Vertex * > &verts_v, const std::vector< Vertex * > &verts_new_v)
Implement a pre-calculated vertex split, as determined by splitPlan.
static VertexHandle insert(const FVector3 &position, const VertexHandle &vf, const std::vector< VertexHandle > &nbs)
Create a vertex and insert it between a vertex and each of a set of vertices.
std::vector< Surface * > sharedSurfaces(const Vertex *other) const
Get the surfaces that this vertex and another vertex both define.
static std::vector< VertexHandle > create(const std::vector< TissueForge::io::ThreeDFVertexData * > &vdata)
Create vertices.
static Vertex * replace(const FVector3 &position, Body *toReplace)
Create a vertex and replace a body with it.
HRESULT insert(Vertex *v1, Vertex *v2)
Inserts a vertex between two vertices.
static VertexHandle create(const FVector3 &position)
Create a vertex.
void updateConnectedVertices()
Update internal connected vertex data.
FloatP_t getVolume() const
Get the current volume.
static HRESULT transferBondsTo(const std::vector< std::pair< Vertex *, Vertex * > > &targets)
Transfer all bonds to other vertices.
static VertexHandle replace(const FVector3 &position, BodyHandle &toReplace)
Create a vertex and replace a body with it.
ParticleHandle * particle() const
Get a handle to the underlying particle, if any.
static Vertex * replace(const FVector3 &position, Surface *toReplace)
Create a vertex and replace a surface with it.
Body * findBody(const FVector3 &dir) const
Find a body defined by this vertex.
FloatP_t getArea() const
Get the current area.
FloatP_t getMass() const
Get the current mass.
static VertexHandle create(TissueForge::io::ThreeDFVertexData *vdata)
Create a vertex.
Vertex * split(const FVector3 &sep)
Split a vertex into an edge.
std::string str() const
Get a summary string.
HRESULT replace(Surface *toReplace)
Replace a surface.
std::vector< Body * > getBodies() const
Get the bodies defined by the vertex.
const FloatP_t & getCachedParticleMass() const
Get the cached particle mass from the most recent update.
Definition tfVertex.h:302
static HRESULT merge(const std::vector< std::vector< Vertex * > > &toMerge, const FloatP_t &lenCf=0.5f)
Merge sets of vertices.
const std::vector< Vertex * > & connectedVertices() const
Get the connected vertices.
Definition tfVertex.h:247
HRESULT splitPlan(const FVector3 &sep, std::vector< Vertex * > &verts_v, std::vector< Vertex * > &verts_new_v)
Calculate the topology of a vertex split without implementing the split.
static VertexHandle replace(const FVector3 &position, SurfaceHandle &toReplace)
Create a vertex and replace a surface with it.
static Vertex * insert(const FVector3 &position, Vertex *vf, std::vector< Vertex * > nbs)
Create a vertex and insert it between a vertex and each of a set of vertices.
static VertexHandle insert(const FVector3 &position, const VertexHandle &v1, const VertexHandle &v2)
Create a vertex and inserts it between two vertices.
HRESULT transferBondsTo(Vertex *other)
Transfer all bonds to another vertex.
const FVector3 & getVelocity() const
Get the current velocity.
Definition tfVertex.h:297
static VertexHandle create(const unsigned int &_pid)
Create a vertex.
static std::vector< VertexHandle > create(const std::vector< FVector3 > &positions)
Create vertices.
const FVector3 & getPosition() const
Get the current position.
Definition tfVertex.h:284
HRESULT setPosition(const FVector3 &pos, const bool &updateChildren=true)
Set the current position.
HRESULT insert(Vertex *vf, std::vector< Vertex * > nbs)
Insert a vertex between a vertex and each of a set of vertices.
HRESULT updateProperties()
Update the properties of the underlying particle.
HRESULT merge(Vertex *toRemove, const FloatP_t &lenCf=0.5f)
Merge with a vertex.
static Vertex * insert(const FVector3 &position, Vertex *v1, Vertex *v2)
Create a vertex and inserts it between two vertices.
Surface * findSurface(const FVector3 &dir) const
Find a surface defined by this vertex.
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26
A handle to a particle.
Definition tfParticle.h:313
Structure containing information on each particle type.
Definition tfParticle.h:768
3D data file vertex data
Definition tfThreeDFVertexData.h:41
A handle to a Body.
Definition tfBody.h:345
A handle to a Surface.
Definition tfSurface.h:630
A handle to a Vertex.
Definition tfVertex.h:493
bool defines(const BodyHandle &b) const
Test whether defines a body.
const int getPartId() const
Get the id of the underlying particle.
HRESULT insert(const SurfaceHandle &s, const SurfaceHandle &before) const
Insert a surface before another surface.
HRESULT splitPlan(const FVector3 &sep, const std::vector< VertexHandle > &verts_v, const std::vector< VertexHandle > &verts_new_v)
Calculate the topology of a vertex split without implementing the split.
void updateConnectedVertices() const
Update internal connected vertex data.
std::vector< SurfaceHandle > getSurfaces() const
Get the surfaces defined by the vertex.
HRESULT positionChanged()
Update internal data due to a change in position.
VertexHandle splitExecute(const FVector3 &sep, const std::vector< VertexHandle > &verts_v, const std::vector< VertexHandle > &verts_new_v)
Implement a pre-calculated vertex split, as determined by splitPlan.
HRESULT destroy()
Destroy the vertex.
HRESULT merge(VertexHandle &toRemove, const FloatP_t &lenCf=0.5f)
Merge with a vertex.
HRESULT remove(const SurfaceHandle &s) const
Remove a surface.
std::vector< SurfaceHandle > sharedSurfaces(const VertexHandle &other) const
Get the surfaces that this vertex and another vertex both define.
HRESULT insert(const SurfaceHandle &s, const int &idx) const
Insert a surface at a location in the list of surfaces.
HRESULT replace(const SurfaceHandle &toInsert, const int &idx) const
Replace a surface at a location in the list of surfaces.
FloatP_t getMass() const
Get the current mass.
std::string toString() const
Get a JSON string representation.
std::vector< BodyHandle > getBodies() const
Get the bodies defined by the vertex.
BodyHandle findBody(const FVector3 &dir) const
Find a body defined by this vertex.
HRESULT add(const SurfaceHandle &s) const
Add a surface.
HRESULT transferBondsTo(const VertexHandle &other) const
Transfer all bonds to another vertex.
MeshObjTypeLabel objType() const
Get the mesh object type.
Definition tfVertex.h:523
SurfaceHandle findSurface(const FVector3 &dir) const
Find a surface defined by this vertex.
HRESULT setPosition(const FVector3 &pos, const bool &updateChildren=true)
Set the current position.
FVector3 getVelocity() const
Get the current velocity.
HRESULT replace(BodyHandle &toReplace)
Replace a body.
std::string str() const
Get a summary string.
VertexHandle split(const FVector3 &sep)
Split a vertex into an edge.
HRESULT replace(const SurfaceHandle &toInsert, const SurfaceHandle &toRemove) const
Replace a surface with another surface.
ParticleHandle * particle() const
Get a handle to the underlying particle, if any.
HRESULT insert(const VertexHandle &v1, const VertexHandle &v2)
Inserts a vertex between two vertices.
HRESULT replace(SurfaceHandle &toReplace) const
Replace a surface.
HRESULT insert(const VertexHandle &vf, const std::vector< VertexHandle > &nbs)
Insert a vertex between a vertex and each of a set of vertices.
FloatP_t getArea() const
Get the current area.
bool validate()
Validate the vertex.
std::vector< VertexHandle > connectedVertices() const
Get the connected vertices.
HRESULT updateProperties() const
Update the properties of the underlying particle.
FVector3 getPosition() const
Get the current position.
static VertexHandle fromString(const std::string &s)
Create an instance from a JSON string representation.
bool defines(const SurfaceHandle &s) const
Test whether defines a surface.
Vertex * vertex() const
Get the underlying object, if any.
FloatP_t getVolume() const
Get the current volume.
int32_t HRESULT
Definition tf_port.h:255
MeshObjTypeLabel
Mesh object type enum.
Definition tfMeshObj.h:48