Skip to content

Commit 5adab81

Browse files
committed
More primitives converted to make use of new multi-block mesher features.
1 parent 1cef3f5 commit 5adab81

13 files changed

+798
-361
lines changed

GeomLib/GObject.cpp

+7-14
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ void GObject::BuildGMesh()
573573
assert(false);
574574
}
575575
}
576+
577+
gmesh->Update();
576578
}
577579
else
578580
{
@@ -816,7 +818,7 @@ void GObject::BuildFacePolygon(GLMesh* glmesh, GFace& f)
816818
for (int i=0; i<pm->Faces(); ++i) pm->Face(i).pid = f.GetLocalID();
817819

818820
// attach this mesh to our mesh
819-
glmesh->Attach(*pm);
821+
glmesh->Attach(*pm, false);
820822

821823
// don't forget to delete this mesh
822824
delete pm;
@@ -1161,9 +1163,7 @@ void GObject::BuildFaceExtrude(GLMesh* glmesh, GFace& f)
11611163
assert(false);
11621164
}
11631165

1164-
m.Update();
1165-
m.UpdateNormals();
1166-
glmesh->Attach(m);
1166+
glmesh->Attach(m, false);
11671167
}
11681168

11691169
//-----------------------------------------------------------------------------
@@ -1386,9 +1386,7 @@ void GObject::BuildFaceRevolve(GLMesh* glmesh, GFace& f)
13861386
assert(false);
13871387
}
13881388

1389-
m.Update();
1390-
m.UpdateNormals();
1391-
glmesh->Attach(m);
1389+
glmesh->Attach(m, false);
13921390
}
13931391

13941392
//-----------------------------------------------------------------------------
@@ -1508,9 +1506,7 @@ void GObject::BuildFaceRevolveWedge(GLMesh* glmesh, GFace& f)
15081506
assert(false);
15091507
}
15101508

1511-
m.Update();
1512-
m.UpdateNormals();
1513-
glmesh->Attach(m);
1509+
glmesh->Attach(m, false);
15141510
}
15151511

15161512
//-----------------------------------------------------------------------------
@@ -1604,10 +1600,7 @@ void GObject::BuildFaceQuad(GLMesh* glmesh, GFace &f)
16041600
e.n[1] = (M - i - 1)*(M+1);
16051601
e.pid = Edge(f.m_edge[3].nid)->GetLocalID();
16061602
}
1607-
1608-
m.Update();
1609-
m.UpdateNormals();
1610-
glmesh->Attach(m);
1603+
glmesh->Attach(m, false);
16111604
}
16121605

16131606
// get the mesh of an edge curve

GeomLib/geom.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -459,3 +459,28 @@ bool GM_ARC::Intersect(GM_CIRCLE_ARC &e, double &w)
459459
assert(false);
460460
return false;
461461
}
462+
463+
//===============================================================================
464+
GM_CIRCLE_3P_ARC::GM_CIRCLE_3P_ARC(const vec3d& c, const vec3d& a, const vec3d& b, int nw)
465+
{
466+
m_c = c;
467+
m_a = a;
468+
m_b = b;
469+
m_winding = nw;
470+
}
471+
472+
vec3d GM_CIRCLE_3P_ARC::Point(double l)
473+
{
474+
vec3d r1 = m_a - m_c;
475+
vec3d r2 = m_b - m_c;
476+
vec3d n = r1 ^ r2; n.Normalize();
477+
quatd q(n, vec3d(0, 0, 1)), qi = q.Inverse();
478+
q.RotateVector(r1);
479+
q.RotateVector(r2);
480+
GM_CIRCLE_ARC c(vec2d(0, 0), vec2d(r1.x, r1.y), vec2d(r2.x, r2.y), m_winding);
481+
vec2d a = c.Point(l);
482+
vec3d p(a.x, a.y, 0);
483+
qi.RotateVector(p);
484+
vec3d r = p + m_c;
485+
return r;
486+
}

GeomLib/geom.h

+17
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class GM_LINE
5151
};
5252

5353
//-----------------------------------------------------------------------------
54+
// circular arc in 2D
5455
class GM_CIRCLE_ARC
5556
{
5657
public:
@@ -96,3 +97,19 @@ class GM_ARC
9697
double m_R0, m_R1; // radii of ellipsoid
9798
double m_w0, m_w1; // start/end parameter
9899
};
100+
101+
//-----------------------------------------------------------------------------
102+
// circular arc in 3D
103+
// c = center
104+
// a,b = two points defining the circular arc
105+
class GM_CIRCLE_3P_ARC
106+
{
107+
public:
108+
GM_CIRCLE_3P_ARC(const vec3d& c, const vec3d& a, const vec3d& b, int nw = 1);
109+
110+
vec3d Point(double l);
111+
112+
public:
113+
vec3d m_c, m_a, m_b;
114+
int m_winding;
115+
};

0 commit comments

Comments
 (0)