+ removed unneeded pure virtual method getFaces from PropertyComplexGeoData
+ extend interface of ComplexGeoData::getPoints to also return normals if available
This commit is contained in:
parent
288841cf98
commit
0ea6a2ed0d
|
@ -138,6 +138,7 @@ public:
|
||||||
{ return Base::Vector3d(); }
|
{ return Base::Vector3d(); }
|
||||||
/** Get points from object with given accuracy */
|
/** Get points from object with given accuracy */
|
||||||
virtual void getPoints(std::vector<Base::Vector3d> &Points,
|
virtual void getPoints(std::vector<Base::Vector3d> &Points,
|
||||||
|
std::vector<Base::Vector3d> &Normals,
|
||||||
float Accuracy, uint16_t flags=0) const {}
|
float Accuracy, uint16_t flags=0) const {}
|
||||||
/** Get lines from object with given accuracy */
|
/** Get lines from object with given accuracy */
|
||||||
virtual void getLines(std::vector<Base::Vector3d> &Points,std::vector<Line> &lines,
|
virtual void getLines(std::vector<Base::Vector3d> &Points,std::vector<Line> &lines,
|
||||||
|
|
|
@ -357,9 +357,6 @@ public:
|
||||||
//@{
|
//@{
|
||||||
virtual const Data::ComplexGeoData* getComplexData() const = 0;
|
virtual const Data::ComplexGeoData* getComplexData() const = 0;
|
||||||
virtual Base::BoundBox3d getBoundingBox() const = 0;
|
virtual Base::BoundBox3d getBoundingBox() const = 0;
|
||||||
virtual void getFaces(std::vector<Base::Vector3d> &Points,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &Topo,
|
|
||||||
float Accuracy, uint16_t flags=0) const = 0;
|
|
||||||
//@}
|
//@}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -91,13 +91,6 @@ void PropertyFemMesh::transformGeometry(const Base::Matrix4D &rclMat)
|
||||||
hasSetValue();
|
hasSetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyFemMesh::getFaces(std::vector<Base::Vector3d> &aPoints,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &aTopo,
|
|
||||||
float accuracy, uint16_t flags) const
|
|
||||||
{
|
|
||||||
_FemMesh->getFaces(aPoints, aTopo, accuracy, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *PropertyFemMesh::getPyObject(void)
|
PyObject *PropertyFemMesh::getPyObject(void)
|
||||||
{
|
{
|
||||||
FemMeshPy* mesh = new FemMeshPy(&*_FemMesh);
|
FemMeshPy* mesh = new FemMeshPy(&*_FemMesh);
|
||||||
|
|
|
@ -61,9 +61,6 @@ public:
|
||||||
/** Returns the bounding box around the underlying mesh kernel */
|
/** Returns the bounding box around the underlying mesh kernel */
|
||||||
Base::BoundBox3d getBoundingBox() const;
|
Base::BoundBox3d getBoundingBox() const;
|
||||||
void transformGeometry(const Base::Matrix4D &rclMat);
|
void transformGeometry(const Base::Matrix4D &rclMat);
|
||||||
void getFaces(std::vector<Base::Vector3d> &Points,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &Topo,
|
|
||||||
float Accuracy, uint16_t flags=0) const;
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Python interface */
|
/** @name Python interface */
|
||||||
|
|
|
@ -293,7 +293,9 @@ private:
|
||||||
if (shape && shape->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
if (shape && shape->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
||||||
std::vector<Base::Vector3d> aPoints;
|
std::vector<Base::Vector3d> aPoints;
|
||||||
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
||||||
static_cast<App::PropertyComplexGeoData*>(shape)->getFaces(aPoints, aTopo,fTolerance);
|
const Data::ComplexGeoData* data = static_cast<App::PropertyComplexGeoData*>(shape)->getComplexData();
|
||||||
|
if (data) {
|
||||||
|
data->getFaces(aPoints, aTopo,fTolerance);
|
||||||
mesh->addFacets(aTopo, aPoints);
|
mesh->addFacets(aTopo, aPoints);
|
||||||
if (global_mesh.countFacets() == 0)
|
if (global_mesh.countFacets() == 0)
|
||||||
global_mesh = *mesh;
|
global_mesh = *mesh;
|
||||||
|
@ -301,6 +303,7 @@ private:
|
||||||
global_mesh.addMesh(*mesh);
|
global_mesh.addMesh(*mesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Base::Console().Message("'%s' is not a mesh or shape, export will be ignored.\n", obj->Label.getValue());
|
Base::Console().Message("'%s' is not a mesh or shape, export will be ignored.\n", obj->Label.getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,6 +253,7 @@ MeshPoint MeshObject::getPoint(unsigned long index) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshObject::getPoints(std::vector<Base::Vector3d> &Points,
|
void MeshObject::getPoints(std::vector<Base::Vector3d> &Points,
|
||||||
|
std::vector<Base::Vector3d> &Normals,
|
||||||
float Accuracy, uint16_t flags) const
|
float Accuracy, uint16_t flags) const
|
||||||
{
|
{
|
||||||
unsigned long ctpoints = _kernel.CountPoints();
|
unsigned long ctpoints = _kernel.CountPoints();
|
||||||
|
|
|
@ -129,6 +129,7 @@ public:
|
||||||
double getVolume() const;
|
double getVolume() const;
|
||||||
/** Get points from object with given accuracy */
|
/** Get points from object with given accuracy */
|
||||||
virtual void getPoints(std::vector<Base::Vector3d> &Points,
|
virtual void getPoints(std::vector<Base::Vector3d> &Points,
|
||||||
|
std::vector<Base::Vector3d> &Normals,
|
||||||
float Accuracy, uint16_t flags=0) const;
|
float Accuracy, uint16_t flags=0) const;
|
||||||
virtual void getFaces(std::vector<Base::Vector3d> &Points,std::vector<Facet> &Topo,
|
virtual void getFaces(std::vector<Base::Vector3d> &Points,std::vector<Facet> &Topo,
|
||||||
float Accuracy, uint16_t flags=0) const;
|
float Accuracy, uint16_t flags=0) const;
|
||||||
|
|
|
@ -502,13 +502,6 @@ Base::BoundBox3d PropertyMeshKernel::getBoundingBox() const
|
||||||
return _meshObject->getBoundBox();
|
return _meshObject->getBoundBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyMeshKernel::getFaces(std::vector<Base::Vector3d> &aPoints,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &aTopo,
|
|
||||||
float accuracy, uint16_t flags) const
|
|
||||||
{
|
|
||||||
_meshObject->getFaces(aPoints, aTopo, accuracy, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int PropertyMeshKernel::getMemSize (void) const
|
unsigned int PropertyMeshKernel::getMemSize (void) const
|
||||||
{
|
{
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
|
|
|
@ -207,10 +207,6 @@ public:
|
||||||
const Data::ComplexGeoData* getComplexData() const;
|
const Data::ComplexGeoData* getComplexData() const;
|
||||||
/** Returns the bounding box around the underlying mesh kernel */
|
/** Returns the bounding box around the underlying mesh kernel */
|
||||||
Base::BoundBox3d getBoundingBox() const;
|
Base::BoundBox3d getBoundingBox() const;
|
||||||
/** Get faces from object with given accuracy */
|
|
||||||
virtual void getFaces(std::vector<Base::Vector3d> &Points,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &Topo,
|
|
||||||
float Accuracy, uint16_t flags=0) const;
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Modification */
|
/** @name Modification */
|
||||||
|
|
|
@ -526,10 +526,13 @@ void CmdMeshFromGeometry::activated(int iMsg)
|
||||||
if (jt->first == "Shape" && jt->second->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
if (jt->first == "Shape" && jt->second->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
||||||
std::vector<Base::Vector3d> aPoints;
|
std::vector<Base::Vector3d> aPoints;
|
||||||
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
||||||
static_cast<App::PropertyComplexGeoData*>(jt->second)->getFaces(aPoints, aTopo,(float)tol);
|
const Data::ComplexGeoData* data = static_cast<App::PropertyComplexGeoData*>(jt->second)->getComplexData();
|
||||||
|
if (data) {
|
||||||
|
data->getFaces(aPoints, aTopo,(float)tol);
|
||||||
mesh.setFacets(aTopo, aPoints);
|
mesh.setFacets(aTopo, aPoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create a mesh feature and assign the mesh
|
// create a mesh feature and assign the mesh
|
||||||
Mesh::Feature* mf = static_cast<Mesh::Feature*>(doc->addObject("Mesh::Feature","Mesh"));
|
Mesh::Feature* mf = static_cast<Mesh::Feature*>(doc->addObject("Mesh::Feature","Mesh"));
|
||||||
|
|
|
@ -133,13 +133,6 @@ Base::BoundBox3d PropertyPartShape::getBoundingBox() const
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyPartShape::getFaces(std::vector<Base::Vector3d> &aPoints,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &aTopo,
|
|
||||||
float accuracy, uint16_t flags) const
|
|
||||||
{
|
|
||||||
_Shape.getFaces(aPoints, aTopo, accuracy, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropertyPartShape::transformGeometry(const Base::Matrix4D &rclTrf)
|
void PropertyPartShape::transformGeometry(const Base::Matrix4D &rclTrf)
|
||||||
{
|
{
|
||||||
aboutToSetValue();
|
aboutToSetValue();
|
||||||
|
|
|
@ -67,10 +67,6 @@ public:
|
||||||
//@{
|
//@{
|
||||||
/** Returns the bounding box around the underlying mesh kernel */
|
/** Returns the bounding box around the underlying mesh kernel */
|
||||||
Base::BoundBox3d getBoundingBox() const;
|
Base::BoundBox3d getBoundingBox() const;
|
||||||
/** Get faces from object with given accuracy */
|
|
||||||
virtual void getFaces(std::vector<Base::Vector3d> &Points,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &Topo,
|
|
||||||
float Accuracy, uint16_t flags=0) const;
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Python interface */
|
/** @name Python interface */
|
||||||
|
|
|
@ -76,13 +76,6 @@ Base::BoundBox3d PropertyPointKernel::getBoundingBox() const
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertyPointKernel::getFaces(std::vector<Base::Vector3d> &Points,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &Topo,
|
|
||||||
float Accuracy, uint16_t flags) const
|
|
||||||
{
|
|
||||||
_cPoints->getFaces(Points, Topo, Accuracy, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
PyObject *PropertyPointKernel::getPyObject(void)
|
PyObject *PropertyPointKernel::getPyObject(void)
|
||||||
{
|
{
|
||||||
PointsPy* points = new PointsPy(&*_cPoints);
|
PointsPy* points = new PointsPy(&*_cPoints);
|
||||||
|
|
|
@ -52,10 +52,6 @@ public:
|
||||||
//@{
|
//@{
|
||||||
/** Returns the bounding box around the underlying mesh kernel */
|
/** Returns the bounding box around the underlying mesh kernel */
|
||||||
Base::BoundBox3d getBoundingBox() const;
|
Base::BoundBox3d getBoundingBox() const;
|
||||||
/** Get faces from object with given accuracy */
|
|
||||||
virtual void getFaces(std::vector<Base::Vector3d> &Points,
|
|
||||||
std::vector<Data::ComplexGeoData::Facet> &Topo,
|
|
||||||
float Accuracy, uint16_t flags=0) const;
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name Python interface */
|
/** @name Python interface */
|
||||||
|
|
|
@ -195,7 +195,8 @@ void CmdPointsConvert::activated(int iMsg)
|
||||||
if (prop) {
|
if (prop) {
|
||||||
const Data::ComplexGeoData* data = prop->getComplexData();
|
const Data::ComplexGeoData* data = prop->getComplexData();
|
||||||
std::vector<Base::Vector3d> vertexes;
|
std::vector<Base::Vector3d> vertexes;
|
||||||
data->getPoints(vertexes, 0.0f);
|
std::vector<Base::Vector3d> normals;
|
||||||
|
data->getPoints(vertexes, normals, 0.0f);
|
||||||
if (!vertexes.empty()) {
|
if (!vertexes.empty()) {
|
||||||
App::Document* doc = (*it)->getDocument();
|
App::Document* doc = (*it)->getDocument();
|
||||||
Points::Feature* fea = static_cast<Points::Feature*>(doc->addObject("Points::Feature", "Points"));
|
Points::Feature* fea = static_cast<Points::Feature*>(doc->addObject("Points::Feature", "Points"));
|
||||||
|
|
|
@ -107,7 +107,11 @@ void CmdApproxPlane::activated(int iMsg)
|
||||||
if (jt->second->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
if (jt->second->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
||||||
std::vector<Base::Vector3d> aPoints;
|
std::vector<Base::Vector3d> aPoints;
|
||||||
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
||||||
static_cast<App::PropertyComplexGeoData*>(jt->second)->getFaces(aPoints, aTopo,0.01f);
|
const Data::ComplexGeoData* data = static_cast<App::PropertyComplexGeoData*>(jt->second)->getComplexData();
|
||||||
|
if (!data)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
data->getFaces(aPoints, aTopo,0.01f);
|
||||||
|
|
||||||
// get a reference normal for the plane fit
|
// get a reference normal for the plane fit
|
||||||
Base::Vector3f refNormal(0,0,0);
|
Base::Vector3f refNormal(0,0,0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user