make xs compilable

This commit is contained in:
Michael Kirsch 2019-04-16 22:19:12 +02:00 committed by Joseph Lenox
parent 3ade7bb058
commit e8452befd3
5 changed files with 39 additions and 4 deletions

View File

@ -626,7 +626,7 @@ ModelObject::raw_mesh() const
TriangleMesh mesh;
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) {
if ((*v)->modifier) continue;
mesh.merge((*v)->get_transformed_mesh());
mesh.merge((*v)->get_transformed_mesh(nullptr));
}
return mesh;
}
@ -1026,6 +1026,13 @@ ModelVolume::get_transformed_mesh(TransformationMatrix const * additional_trafo)
return mesh;
}
TriangleMesh*
ModelVolume::get_transformed_meshptr(TransformationMatrix const * additional_trafo)
{
this->transformed_mesh = get_transformed_mesh(additional_trafo);
return &(this->transformed_mesh);
}
t_model_material_id
ModelVolume::material_id() const
{
@ -1111,6 +1118,12 @@ TransformationMatrix ModelInstance::get_trafo_matrix(bool dont_translate) const
return trafo;
}
TransformationMatrix* ModelInstance::get_trafo_matrixptr(bool dont_translate)
{
this->trafo = this->get_trafo_matrix(dont_translate);
return &(this->trafo);
}
BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mesh, bool dont_translate) const
{
// rotate around mesh origin

View File

@ -478,9 +478,14 @@ class ModelVolume
ModelObject* get_object() const { return this->object; };
/// Get the ModelVolume's mesh, transformed by the ModelVolume's TransformationMatrix
/// \param additional_trafo optional additional transformation
/// \param additional_trafo additional transformation
/// \return TriangleMesh the transformed mesh
TriangleMesh get_transformed_mesh(TransformationMatrix const * additional_trafo = nullptr) const;
TriangleMesh get_transformed_mesh(TransformationMatrix const * additional_trafo) const;
/// Get the ModelVolume's mesh as pointer, transformed by the ModelVolume's TransformationMatrix
/// \param additional_trafo additional transformation
/// \return TriangleMesh the transformed mesh
TriangleMesh* get_transformed_meshptr(TransformationMatrix const * additional_trafo);
/// Get the material id of this ModelVolume object
/// \return t_model_material_id the material id string
@ -509,6 +514,8 @@ class ModelVolume
///< The id of the this ModelVolume
t_model_material_id _material_id;
TriangleMesh transformed_mesh; ///< The transformed mesh only to be used by the perl binding
/// Constructor
/// \param object ModelObject* pointer to the owner ModelObject
/// \param mesh TriangleMesh the mesh of the new ModelVolume object
@ -552,6 +559,10 @@ class ModelInstance
/// \param dont_translate bool whether to translate the mesh or not
TransformationMatrix get_trafo_matrix(bool dont_translate = false) const;
/// Returns a pointer to TransformationMatrix defined by the instance's Transform an external TriangleMesh to the returned TriangleMesh object
/// \param dont_translate bool whether to translate the mesh or not
TransformationMatrix* get_trafo_matrixptr(bool dont_translate = false);
/// Calculate a bounding box of a transformed mesh. To be called on an external mesh.
/// \param mesh TriangleMesh* pointer to the the mesh
/// \param dont_translate bool whether to translate the bounding box or not
@ -588,6 +599,8 @@ class ModelInstance
/// Swap attributes between another ModelInstance object
/// \param other ModelInstance& the other instance object
void swap(ModelInstance &other);
TransformationMatrix trafo; ///< Trafomatrix for perl binding
};
}

View File

@ -290,6 +290,8 @@ ModelMaterial::attributes()
%code%{ RETVAL = &THIS->config; %};
Ref<TriangleMesh> mesh()
%code%{ RETVAL = &THIS->mesh; %};
Ref<TriangleMesh> get_transformed_meshptr(TransformationMatrix * additional_trafo = nullptr);
bool modifier()
%code%{ RETVAL = THIS->modifier; %};
@ -327,6 +329,8 @@ ModelMaterial::attributes()
void set_offset(Pointf *offset)
%code%{ THIS->offset = *offset; %};
void transform_mesh(TriangleMesh* mesh, bool dont_translate = false) const;
Ref<TransformationMatrix> get_trafo_matrixptr(bool dont_translate);
void transform_mesh(TriangleMesh* mesh, bool dont_translate) const;
void transform_polygon(Polygon* polygon) const;
};

View File

@ -57,6 +57,9 @@ TriangleMesh* O_OBJECT_SLIC3R
Ref<TriangleMesh> O_OBJECT_SLIC3R_T
Clone<TriangleMesh> O_OBJECT_SLIC3R_T
TransformationMatrix* O_OBJECT_SLIC3R
Ref<TransformationMatrix> O_OBJECT_SLIC3R_T
SLAPrint* O_OBJECT_SLIC3R
Ref<SLAPrint> O_OBJECT_SLIC3R_T
Clone<SLAPrint> O_OBJECT_SLIC3R_T

View File

@ -88,6 +88,8 @@
%typemap{TriangleMesh*};
%typemap{Ref<TriangleMesh>}{simple};
%typemap{Clone<TriangleMesh>}{simple};
%typemap{TransformationMatrix*};
%typemap{Ref<TransformationMatrix>}{simple};
%typemap{PolylineCollection*};
%typemap{Ref<PolylineCollection>}{simple};
%typemap{Clone<PolylineCollection>}{simple};