Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support degenerate tori with negative major radius #157

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions iGeom/iGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void iGeom_createTorus(iGeom_Instance instance,
/*out*/ iBase_EntityHandle *geom_entity,
int* err)
{
if (minor_rad >= major_rad) {
if (minor_rad >= fabs(major_rad)) {
// first calculate the 3 control vertices and 2 control points
double height = sqrt((minor_rad*minor_rad) - (major_rad*major_rad));
double maxima = major_rad+minor_rad;
Expand Down Expand Up @@ -273,16 +273,31 @@ void iGeom_createTorus(iGeom_Instance instance,
STRAIGHT_CURVE_TYPE, v1, v5);
profile_edges.insert(curve);

//the first arc
curve = GeometryModifyTool::instance()->make_RefEdge(ARC_CURVE_TYPE, v1,
v3, &v2_pos);
profile_edges.insert(curve);

//the second arc
curve = GeometryModifyTool::instance()->make_RefEdge(ARC_CURVE_TYPE, v3,
v5, &v4_pos);
profile_edges.insert(curve);

if (major_radius > 0) {
// this type of degenerate torus is defined by a cross-section that
// consists of more than 1/2 of a circle, requiring one arc for the
// half and one arc for the bottom half

//the first arc
curve = GeometryModifyTool::instance()->make_RefEdge(ARC_CURVE_TYPE, v1,
v3, &v2_pos);
profile_edges.insert(curve);

//the second arc
curve = GeometryModifyTool::instance()->make_RefEdge(ARC_CURVE_TYPE, v3,
v5, &v4_pos);
profile_edges.insert(curve);
} else {
// this type of degenerate torus is defined by a cross-section that
// consists of less than 1/2 of a circle, requiring only a single
// arc that passes through the end points and the maxima

//only one arc
curve = GeometryModifyTool::instance()->make_RefEdge(ARC_CURVE_TYPE, v1,
v5, &v3_pos);
profile_edges.insert(curve);
}

// make surf from the curves
// This fails in Cubit
RefFace *surf = GeometryModifyTool::instance()->make_RefFace(
Expand Down
Loading