#pragma once#include<itkObjectFactory.h>#include"MeshWrapper.h"#include"TriMeshWrapper.h"#include"ParticleDomain.h"namespaceshapeworks{classMeshDomain:publicParticleDomain{public:usingPointer=std::shared_ptr<MeshDomain>;DomainTypeGetDomainType()constoverride{returnDomainType::Mesh;}boolApplyConstraints(PointType&p,intidx,booldbg=false)constoverride;boolApplyVectorConstraints(VectorDoubleType&gradE,constPointType&pos)const;VectorDoubleTypeProjectVectorToSurfaceTangent(VectorDoubleType&gradE,constPointType&pos,intidx)constoverride;PointTypeUpdateParticlePosition(constPointType&point,intidx,VectorDoubleType&update)constoverride;virtualvoidInvalidateParticlePosition(intidx)constoverride;doubleGetCurvature(constPointType&p,intidx)constoverride{// TODO Why not return the actual curvaturereturnGetSurfaceMeanCurvature();}inlinedoubleGetSurfaceMeanCurvature()constoverride{// This function is used by MeanCurvatureAttribute which is used for good/bad assessment// These arbitrary values should eventually be replaced with actual computationreturn0.15;}inlinedoubleGetSurfaceStdDevCurvature()constoverride{// This function is used by MeanCurvatureAttribute which is used for good/bad assessment// These arbitrary values should eventually be replaced with actual computationreturn0.02;}constPointType&GetLowerBound()constoverride{returnmeshWrapper->GetMeshLowerBound();}constPointType&GetUpperBound()constoverride{returnmeshWrapper->GetMeshUpperBound();}PointTypeGetZeroCrossingPoint()constoverride{// TODO Hong// Apply constraints somehowif(meshWrapper==nullptr){// Fixed domain. Unsure if this is the correct thing to do, but it preserves existing behaviour.PointTypep;p[0]=p[1]=p[2]=0;returnp;}returnmeshWrapper->GetPointOnMesh();}PointTypeGetValidLocationNear(PointTypep)constoverride{PointTypevalid;valid[0]=p[0];valid[1]=p[1];valid[2]=p[2];ApplyConstraints(valid,-1);returnvalid;}doubleGetSurfaceArea()constoverride{// TODO return actual surface areareturn0;}doubleGetMaxDiameter()constoverride;inlinevnl_vector_fixed<float,DIMENSION>SampleGradientAtPoint(constPointType&point,intidx)constoverride{returnmeshWrapper->SampleNormalAtPoint(point,idx);}inlinevnl_vector_fixed<float,DIMENSION>SampleNormalAtPoint(constPointType&point,intidx)constoverride{returnmeshWrapper->SampleNormalAtPoint(point,idx);}inlineGradNTypeSampleGradNAtPoint(constPointType&p,intidx)constoverride{returnmeshWrapper->SampleGradNAtPoint(p,idx);}inlinedoubleDistance(constPointType&a,intidx_a,constPointType&b,intidx_b,vnl_vector_fixed<double,DIMENSION>*out_grad=nullptr)constoverride{returnmeshWrapper->ComputeDistance(a,idx_a,b,idx_b,out_grad);}inlinedoubleSquaredDistance(constPointType&a,intidx_a,constPointType&b,intidx_b)constoverride{doubledist=meshWrapper->ComputeDistance(a,idx_a,b,idx_b);returndist*dist;}inlineboolIsWithinDistance(constPointType&a,intidx_a,constPointType&b,intidx_b,doubletest_dist,double&dist)constoverride{returnmeshWrapper->IsWithinDistance(a,idx_a,b,idx_b,test_dist,dist);}voidDeleteImages()override{// TODO Change this to a generic delete function}voidDeletePartialDerivativeImages()override{// TODO Change this to a generic delete function}voidSetMesh(std::shared_ptr<shapeworks::MeshWrapper>mesh_){this->m_FixedDomain=false;meshWrapper=mesh_;}voidUpdateZeroCrossingPoint()override{}private:std::shared_ptr<shapeworks::MeshWrapper>meshWrapper;PointTypem_ZeroCrossingPoint;};}// namespace shapeworks