Skip to content

Commit

Permalink
Merge pull request cdyk#70 from VegarRingdalAibel/bugfix
Browse files Browse the repository at this point in the history
fix for when base radius is 0 on sphere based shapes
  • Loading branch information
cdyk authored Apr 29, 2023
2 parents cfc6114 + 3255432 commit de6df5c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/TriangulationFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,11 @@ Triangulation* TriangulationFactory::cylinder(Arena* arena, const Geometry* geo,

Triangulation* TriangulationFactory::sphereBasedShape(Arena* arena, const Geometry* geo, float radius, float arc, float shift_z, float scale_z, float scale)
{

if (!std::isfinite(scale_z)) {
scale_z = 0;
}

unsigned segments = sagittaBasedSegmentCount(twopi, radius, scale);
unsigned samples = segments; // Assumed to be closed

Expand All @@ -1016,6 +1021,8 @@ Triangulation* TriangulationFactory::sphereBasedShape(Arena* arena, const Geomet
is_sphere = true;
}



unsigned min_rings = 3;// arc <= half_pi ? 2 : 3;
unsigned rings = unsigned(std::max(float(min_rings), scale_z * samples*arc*(1.f / twopi)));

Expand Down

0 comments on commit de6df5c

Please sign in to comment.