mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 20:03:47 +00:00
Make Repair() idempotent and lowercase
This commit is contained in:
@@ -62,8 +62,8 @@ void TriangleMesh::ReadFromPerl(SV* vertices, SV* facets)
|
||||
}
|
||||
|
||||
void
|
||||
TriangleMesh::Repair() {
|
||||
int i;
|
||||
TriangleMesh::repair() {
|
||||
if (this->repaired) return;
|
||||
|
||||
// checking exact
|
||||
stl_check_facets_exact(&stl);
|
||||
@@ -77,7 +77,7 @@ TriangleMesh::Repair() {
|
||||
float increment = stl.stats.bounding_diameter / 10000.0;
|
||||
int iterations = 2;
|
||||
if (stl.stats.connected_facets_3_edge < stl.stats.number_of_facets) {
|
||||
for (i = 0; i < iterations; i++) {
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
if (stl.stats.connected_facets_3_edge < stl.stats.number_of_facets) {
|
||||
//printf("Checking nearby. Tolerance= %f Iteration=%d of %d...", tolerance, i + 1, iterations);
|
||||
stl_check_facets_nearby(&stl, tolerance);
|
||||
@@ -486,7 +486,7 @@ TriangleMesh::split() const
|
||||
std::set<int> seen_facets;
|
||||
|
||||
// we need neighbors
|
||||
if (!this->repaired) CONFESS("split() requires Repair()");
|
||||
if (!this->repaired) CONFESS("split() requires repair()");
|
||||
|
||||
// loop while we have remaining facets
|
||||
while (1) {
|
||||
|
||||
@@ -20,7 +20,7 @@ class TriangleMesh
|
||||
SV* to_SV();
|
||||
void ReadSTLFile(char* input_file);
|
||||
void ReadFromPerl(SV* vertices, SV* facets);
|
||||
void Repair();
|
||||
void repair();
|
||||
void WriteOBJFile(char* output_file);
|
||||
void scale(float factor);
|
||||
void translate(float x, float y, float z);
|
||||
|
||||
@@ -17,7 +17,7 @@ my $cube = {
|
||||
{
|
||||
my $m = Slic3r::TriangleMesh::XS->new;
|
||||
$m->ReadFromPerl($cube->{vertices}, $cube->{facets});
|
||||
$m->Repair;
|
||||
$m->repair;
|
||||
my ($vertices, $facets) = ($m->vertices, $m->facets);
|
||||
|
||||
is_deeply $vertices, $cube->{vertices}, 'vertices arrayref roundtrip';
|
||||
@@ -51,9 +51,9 @@ my $cube = {
|
||||
|
||||
my $m2 = Slic3r::TriangleMesh::XS->new;
|
||||
$m2->ReadFromPerl($cube->{vertices}, $cube->{facets});
|
||||
$m2->Repair;
|
||||
$m2->repair;
|
||||
$m->merge($m2);
|
||||
$m->Repair;
|
||||
$m->repair;
|
||||
is $m->stats->{number_of_facets}, 2 * $m2->stats->{number_of_facets}, 'merge';
|
||||
|
||||
{
|
||||
@@ -65,7 +65,7 @@ my $cube = {
|
||||
{
|
||||
my $m = Slic3r::TriangleMesh::XS->new;
|
||||
$m->ReadFromPerl($cube->{vertices}, $cube->{facets});
|
||||
$m->Repair;
|
||||
$m->repair;
|
||||
my @z = (2,4,8,6,8,10,12,14,16,18,20);
|
||||
my $result = $m->slice(\@z);
|
||||
for my $i (0..$#z) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
~TriangleMesh();
|
||||
void ReadSTLFile(char* input_file);
|
||||
void ReadFromPerl(SV* vertices, SV* facets);
|
||||
void Repair();
|
||||
void repair();
|
||||
void WriteOBJFile(char* output_file);
|
||||
void scale(float factor);
|
||||
void translate(float x, float y, float z);
|
||||
@@ -41,7 +41,7 @@ TriangleMesh::stats()
|
||||
SV*
|
||||
TriangleMesh::vertices()
|
||||
CODE:
|
||||
if (!THIS->repaired) CONFESS("vertices() requires Repair()");
|
||||
if (!THIS->repaired) CONFESS("vertices() requires repair()");
|
||||
|
||||
if (THIS->stl.v_shared == NULL)
|
||||
stl_generate_shared_vertices(&(THIS->stl));
|
||||
@@ -65,7 +65,7 @@ TriangleMesh::vertices()
|
||||
SV*
|
||||
TriangleMesh::facets()
|
||||
CODE:
|
||||
if (!THIS->repaired) CONFESS("facets() requires Repair()");
|
||||
if (!THIS->repaired) CONFESS("facets() requires repair()");
|
||||
|
||||
if (THIS->stl.v_shared == NULL)
|
||||
stl_generate_shared_vertices(&(THIS->stl));
|
||||
|
||||
Reference in New Issue
Block a user