mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
Ported TriangleMesh->scale
This commit is contained in:
parent
a0bd152243
commit
515d5707c9
5 changed files with 22 additions and 4 deletions
|
@ -102,4 +102,9 @@ TriangleMesh::WriteOBJFile(char* output_file) {
|
|||
stl_write_obj(&stl, output_file);
|
||||
}
|
||||
|
||||
void TriangleMesh::scale(float factor)
|
||||
{
|
||||
stl_scale(&(this->stl), factor);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ class TriangleMesh
|
|||
void ReadFromPerl(SV* vertices, SV* facets);
|
||||
void Repair();
|
||||
void WriteOBJFile(char* output_file);
|
||||
void scale(float factor);
|
||||
stl_file stl;
|
||||
};
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ stl_scale(stl_file *stl, float factor)
|
|||
int i;
|
||||
int j;
|
||||
|
||||
// scale extents
|
||||
stl->stats.min.x *= factor;
|
||||
stl->stats.min.y *= factor;
|
||||
stl->stats.min.z *= factor;
|
||||
|
@ -113,6 +114,11 @@ stl_scale(stl_file *stl, float factor)
|
|||
stl->stats.max.y *= factor;
|
||||
stl->stats.max.z *= factor;
|
||||
|
||||
// scale volume
|
||||
if (stl->stats.volume > 0.0) {
|
||||
stl->stats.volume *= (factor * factor * factor);
|
||||
}
|
||||
|
||||
for(i = 0; i < stl->stats.number_of_facets; i++)
|
||||
{
|
||||
for(j = 0; j < 3; j++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue