2008-06-06 08:14:37 +00:00
|
|
|
#include "solvespace.h"
|
|
|
|
|
|
|
|
#define gs (SS.GW.gs)
|
|
|
|
|
2009-01-19 03:33:15 +00:00
|
|
|
bool Group::AssembleLoops(void) {
|
2009-01-19 03:51:00 +00:00
|
|
|
SBezierList sbl;
|
|
|
|
ZERO(&sbl);
|
2009-01-19 03:33:15 +00:00
|
|
|
|
2008-02-10 12:43:48 +00:00
|
|
|
int i;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.entity.n; i++) {
|
|
|
|
Entity *e = &(SK.entity.elem[i]);
|
2008-02-10 12:43:48 +00:00
|
|
|
if(e->group.v != h.v) continue;
|
2009-01-19 03:33:15 +00:00
|
|
|
if(e->construction) continue;
|
2008-02-10 12:43:48 +00:00
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
e->GenerateBezierCurves(&sbl);
|
2008-02-10 12:43:48 +00:00
|
|
|
}
|
2009-01-19 03:33:15 +00:00
|
|
|
|
|
|
|
bool allClosed;
|
2009-01-19 03:51:00 +00:00
|
|
|
bezierLoopSet = SBezierLoopSet::From(&sbl, &poly,
|
|
|
|
&allClosed, &(polyError.notClosedAt));
|
|
|
|
sbl.Clear();
|
2009-01-19 03:33:15 +00:00
|
|
|
return allClosed;
|
2008-02-10 12:43:48 +00:00
|
|
|
}
|
|
|
|
|
2009-01-19 03:33:15 +00:00
|
|
|
void Group::GenerateLoops(void) {
|
2008-06-06 08:14:37 +00:00
|
|
|
poly.Clear();
|
2009-01-19 03:51:00 +00:00
|
|
|
bezierLoopSet.Clear();
|
2008-06-06 08:14:37 +00:00
|
|
|
|
|
|
|
if(type == DRAWING_3D || type == DRAWING_WORKPLANE ||
|
2008-02-13 16:15:33 +00:00
|
|
|
type == ROTATE || type == TRANSLATE || type == IMPORTED)
|
2008-06-06 08:14:37 +00:00
|
|
|
{
|
2009-01-19 03:33:15 +00:00
|
|
|
if(AssembleLoops()) {
|
2008-06-12 04:36:33 +00:00
|
|
|
polyError.how = POLY_GOOD;
|
|
|
|
|
2009-01-23 03:30:30 +00:00
|
|
|
if(!poly.AllPointsInPlane(&(polyError.errorPointAt))) {
|
2008-06-12 04:36:33 +00:00
|
|
|
// The edges aren't all coplanar; so not a good polygon
|
|
|
|
polyError.how = POLY_NOT_COPLANAR;
|
|
|
|
poly.Clear();
|
2009-01-19 03:51:00 +00:00
|
|
|
bezierLoopSet.Clear();
|
2008-06-12 04:36:33 +00:00
|
|
|
}
|
2009-01-23 03:30:30 +00:00
|
|
|
if(poly.SelfIntersecting(&(polyError.errorPointAt))) {
|
|
|
|
polyError.how = POLY_SELF_INTERSECTING;
|
|
|
|
poly.Clear();
|
|
|
|
bezierLoopSet.Clear();
|
|
|
|
}
|
2008-06-06 08:14:37 +00:00
|
|
|
} else {
|
2008-06-12 04:36:33 +00:00
|
|
|
polyError.how = POLY_NOT_CLOSED;
|
2008-06-06 08:14:37 +00:00
|
|
|
poly.Clear();
|
2009-01-19 03:51:00 +00:00
|
|
|
bezierLoopSet.Clear();
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-23 03:30:30 +00:00
|
|
|
void Group::GenerateShellForStepAndRepeat(void) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *src = SK.GetGroup(opA);
|
2009-01-23 03:30:30 +00:00
|
|
|
SShell *srcs = &(src->thisShell); // the shell to step and repeat
|
2008-06-21 22:49:57 +00:00
|
|
|
|
2009-03-15 23:04:45 +00:00
|
|
|
SShell workA, workB;
|
|
|
|
ZERO(&workA);
|
|
|
|
ZERO(&workB);
|
|
|
|
SShell *soFar = &workA, *scratch = &workB;
|
|
|
|
soFar->MakeFromCopyOf(src->PreviousGroupShell());
|
|
|
|
|
2008-06-21 22:49:57 +00:00
|
|
|
int n = (int)valA, a0 = 0;
|
|
|
|
if(subtype == ONE_SIDED && skipFirst) {
|
|
|
|
a0++; n++;
|
|
|
|
}
|
|
|
|
int a;
|
|
|
|
for(a = a0; a < n; a++) {
|
|
|
|
int ap = a*2 - (subtype == ONE_SIDED ? 0 : (n-1));
|
|
|
|
int remap = (a == (n - 1)) ? REMAP_LAST : a;
|
|
|
|
|
2009-03-15 23:04:45 +00:00
|
|
|
SShell transd;
|
|
|
|
ZERO(&transd);
|
2008-06-21 22:49:57 +00:00
|
|
|
if(type == TRANSLATE) {
|
|
|
|
Vector trans = Vector::From(h.param(0), h.param(1), h.param(2));
|
|
|
|
trans = trans.ScaledBy(ap);
|
2009-03-15 23:04:45 +00:00
|
|
|
Quaternion q = Quaternion::From(1, 0, 0, 0);
|
|
|
|
transd.MakeFromTransformationOf(srcs, trans, q);
|
2008-06-21 22:49:57 +00:00
|
|
|
} else {
|
|
|
|
Vector trans = Vector::From(h.param(0), h.param(1), h.param(2));
|
2009-04-19 05:53:16 +00:00
|
|
|
double theta = ap * SK.GetParam(h.param(3))->val;
|
2008-06-21 22:49:57 +00:00
|
|
|
double c = cos(theta), s = sin(theta);
|
|
|
|
Vector axis = Vector::From(h.param(4), h.param(5), h.param(6));
|
|
|
|
Quaternion q = Quaternion::From(c, s*axis.x, s*axis.y, s*axis.z);
|
2009-03-15 23:04:45 +00:00
|
|
|
// Rotation is centered at t; so A(x - t) + t = Ax + (t - At)
|
|
|
|
transd.MakeFromTransformationOf(srcs,
|
|
|
|
trans.Minus(q.Rotate(trans)), q);
|
2008-06-21 22:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-03-16 05:11:06 +00:00
|
|
|
// We need to rewrite any plane face entities to the transformed ones.
|
|
|
|
SSurface *ss;
|
|
|
|
for(ss = transd.surface.First(); ss; ss = transd.surface.NextAfter(ss)){
|
|
|
|
hEntity face = { ss->face };
|
|
|
|
if(face.v == Entity::NO_ENTITY.v) continue;
|
|
|
|
|
|
|
|
face = Remap(face, remap);
|
|
|
|
ss->face = face.v;
|
|
|
|
}
|
|
|
|
|
2008-06-21 22:49:57 +00:00
|
|
|
if(src->meshCombine == COMBINE_AS_DIFFERENCE) {
|
2009-03-15 23:04:45 +00:00
|
|
|
scratch->MakeFromDifferenceOf(soFar, &transd);
|
2009-05-20 03:04:36 +00:00
|
|
|
} else if(src->meshCombine == COMBINE_AS_UNION) {
|
2009-03-15 23:04:45 +00:00
|
|
|
scratch->MakeFromUnionOf(soFar, &transd);
|
2009-05-20 03:04:36 +00:00
|
|
|
} else {
|
|
|
|
scratch->MakeFromAssemblyOf(soFar, &transd);
|
2008-06-21 22:49:57 +00:00
|
|
|
}
|
2009-03-15 23:04:45 +00:00
|
|
|
SWAP(SShell *, scratch, soFar);
|
|
|
|
|
|
|
|
scratch->Clear();
|
|
|
|
transd.Clear();
|
2008-06-21 22:49:57 +00:00
|
|
|
}
|
2009-03-15 23:04:45 +00:00
|
|
|
|
|
|
|
runningShell.Clear();
|
|
|
|
runningShell = *soFar;
|
2008-06-21 22:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 03:30:30 +00:00
|
|
|
void Group::GenerateShellAndMesh(void) {
|
2009-01-19 10:37:10 +00:00
|
|
|
thisShell.Clear();
|
2008-06-21 10:18:20 +00:00
|
|
|
|
2008-06-21 22:49:57 +00:00
|
|
|
if(type == TRANSLATE || type == ROTATE) {
|
2009-01-23 03:30:30 +00:00
|
|
|
GenerateShellForStepAndRepeat();
|
2008-07-06 07:56:24 +00:00
|
|
|
goto done;
|
2008-06-21 22:49:57 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 08:14:37 +00:00
|
|
|
if(type == EXTRUDE) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *src = SK.GetGroup(opA);
|
2008-06-06 08:14:37 +00:00
|
|
|
Vector translate = Vector::From(h.param(0), h.param(1), h.param(2));
|
|
|
|
|
|
|
|
Vector tbot, ttop;
|
|
|
|
if(subtype == ONE_SIDED) {
|
|
|
|
tbot = Vector::From(0, 0, 0); ttop = translate.ScaledBy(2);
|
|
|
|
} else {
|
|
|
|
tbot = translate.ScaledBy(-1); ttop = translate.ScaledBy(1);
|
|
|
|
}
|
2009-01-19 10:37:10 +00:00
|
|
|
|
2009-01-25 09:19:59 +00:00
|
|
|
thisShell.MakeFromExtrusionOf(&(src->bezierLoopSet), tbot, ttop, color);
|
2009-03-15 23:04:45 +00:00
|
|
|
Vector onOrig = src->bezierLoopSet.point;
|
|
|
|
// And for any plane faces, annotate the model with the entity for
|
|
|
|
// that face, so that the user can select them with the mouse.
|
|
|
|
int i;
|
|
|
|
for(i = 0; i < thisShell.surface.n; i++) {
|
|
|
|
SSurface *ss = &(thisShell.surface.elem[i]);
|
|
|
|
hEntity face = Entity::NO_ENTITY;
|
|
|
|
|
|
|
|
Vector p = ss->PointAt(0, 0),
|
|
|
|
n = ss->NormalAt(0, 0).WithMagnitude(1);
|
|
|
|
double d = n.Dot(p);
|
|
|
|
|
|
|
|
if(i == 0 || i == 1) {
|
|
|
|
// These are the top and bottom of the shell.
|
|
|
|
if(fabs((onOrig.Plus(ttop)).Dot(n) - d) < LENGTH_EPS) {
|
|
|
|
face = Remap(Entity::NO_ENTITY, REMAP_TOP);
|
|
|
|
ss->face = face.v;
|
|
|
|
}
|
|
|
|
if(fabs((onOrig.Plus(tbot)).Dot(n) - d) < LENGTH_EPS) {
|
|
|
|
face = Remap(Entity::NO_ENTITY, REMAP_BOTTOM);
|
|
|
|
ss->face = face.v;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// So these are the sides
|
|
|
|
if(ss->degm != 1 || ss->degn != 1) continue;
|
|
|
|
|
|
|
|
Entity *e;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(e = SK.entity.First(); e; e = SK.entity.NextAfter(e)) {
|
2009-03-15 23:04:45 +00:00
|
|
|
if(e->group.v != opA.v) continue;
|
|
|
|
if(e->type != Entity::LINE_SEGMENT) continue;
|
|
|
|
|
2009-04-19 05:53:16 +00:00
|
|
|
Vector a = SK.GetEntity(e->point[0])->PointGetNum(),
|
|
|
|
b = SK.GetEntity(e->point[1])->PointGetNum();
|
2009-03-15 23:04:45 +00:00
|
|
|
a = a.Plus(ttop);
|
|
|
|
b = b.Plus(ttop);
|
|
|
|
// Could get taken backwards, so check all cases.
|
|
|
|
if((a.Equals(ss->ctrl[0][0]) && b.Equals(ss->ctrl[1][0])) ||
|
|
|
|
(b.Equals(ss->ctrl[0][0]) && a.Equals(ss->ctrl[1][0])) ||
|
|
|
|
(a.Equals(ss->ctrl[0][1]) && b.Equals(ss->ctrl[1][1])) ||
|
|
|
|
(b.Equals(ss->ctrl[0][1]) && a.Equals(ss->ctrl[1][1])))
|
|
|
|
{
|
|
|
|
face = Remap(e->h, REMAP_LINE_TO_FACE);
|
|
|
|
ss->face = face.v;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-06 11:35:28 +00:00
|
|
|
} else if(type == LATHE) {
|
2009-04-19 05:53:16 +00:00
|
|
|
Group *src = SK.GetGroup(opA);
|
2008-06-06 11:35:28 +00:00
|
|
|
|
2009-04-29 02:42:44 +00:00
|
|
|
Vector pt = SK.GetEntity(predef.origin)->PointGetNum(),
|
|
|
|
axis = SK.GetEntity(predef.entityB)->VectorGetNum();
|
2008-06-06 11:35:28 +00:00
|
|
|
axis = axis.WithMagnitude(1);
|
|
|
|
|
2009-04-29 02:42:44 +00:00
|
|
|
thisShell.MakeFromRevolutionOf(&(src->bezierLoopSet), pt, axis, color);
|
2008-06-06 08:14:37 +00:00
|
|
|
} else if(type == IMPORTED) {
|
2009-05-19 07:26:38 +00:00
|
|
|
// The imported shell or mesh are copied over, with the appropriate
|
|
|
|
// transformation applied. We also must remap the face entities.
|
2008-06-06 08:14:37 +00:00
|
|
|
Vector offset = {
|
2009-04-19 05:53:16 +00:00
|
|
|
SK.GetParam(h.param(0))->val,
|
|
|
|
SK.GetParam(h.param(1))->val,
|
|
|
|
SK.GetParam(h.param(2))->val };
|
2008-06-06 08:14:37 +00:00
|
|
|
Quaternion q = {
|
2009-04-19 05:53:16 +00:00
|
|
|
SK.GetParam(h.param(3))->val,
|
|
|
|
SK.GetParam(h.param(4))->val,
|
|
|
|
SK.GetParam(h.param(5))->val,
|
|
|
|
SK.GetParam(h.param(6))->val };
|
2008-06-06 08:14:37 +00:00
|
|
|
|
|
|
|
for(int i = 0; i < impMesh.l.n; i++) {
|
|
|
|
STriangle st = impMesh.l.elem[i];
|
|
|
|
|
|
|
|
if(st.meta.face != 0) {
|
|
|
|
hEntity he = { st.meta.face };
|
|
|
|
st.meta.face = Remap(he, 0).v;
|
|
|
|
}
|
|
|
|
st.a = q.Rotate(st.a).Plus(offset);
|
|
|
|
st.b = q.Rotate(st.b).Plus(offset);
|
|
|
|
st.c = q.Rotate(st.c).Plus(offset);
|
|
|
|
}
|
2009-05-19 07:26:38 +00:00
|
|
|
|
|
|
|
thisShell.MakeFromTransformationOf(&impShell, offset, q);
|
|
|
|
SSurface *srf;
|
|
|
|
IdList<SSurface,hSSurface> *sl = &(thisShell.surface);
|
|
|
|
for(srf = sl->First(); srf; srf = sl->NextAfter(srf)) {
|
|
|
|
if(srf->face != 0) {
|
|
|
|
hEntity he = { srf->face };
|
|
|
|
srf->face = Remap(he, 0).v;
|
|
|
|
}
|
|
|
|
}
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
|
|
|
|
2009-01-19 10:37:10 +00:00
|
|
|
runningShell.Clear();
|
2008-06-21 22:49:57 +00:00
|
|
|
|
|
|
|
// If this group contributes no new mesh, then our running mesh is the
|
2008-02-15 11:35:15 +00:00
|
|
|
// same as last time, no combining required. Likewise if we have a mesh
|
|
|
|
// but it's suppressed.
|
2009-01-23 03:30:30 +00:00
|
|
|
if(suppress) {
|
|
|
|
runningShell.MakeFromCopyOf(PreviousGroupShell());
|
2008-07-06 07:56:24 +00:00
|
|
|
goto done;
|
2008-06-21 22:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-05-21 09:06:26 +00:00
|
|
|
// So our group's shell appears in thisShell. Combine this with the
|
|
|
|
// previous group's shell, using the requested operation.
|
2009-01-23 03:30:30 +00:00
|
|
|
SShell *a = PreviousGroupShell();
|
2008-06-06 08:14:37 +00:00
|
|
|
if(meshCombine == COMBINE_AS_UNION) {
|
2009-01-23 03:30:30 +00:00
|
|
|
runningShell.MakeFromUnionOf(a, &thisShell);
|
2008-06-06 08:14:37 +00:00
|
|
|
} else if(meshCombine == COMBINE_AS_DIFFERENCE) {
|
2009-01-23 03:30:30 +00:00
|
|
|
runningShell.MakeFromDifferenceOf(a, &thisShell);
|
2008-06-06 08:14:37 +00:00
|
|
|
} else {
|
2009-05-20 03:04:36 +00:00
|
|
|
runningShell.MakeFromAssemblyOf(a, &thisShell);
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
2008-07-06 07:56:24 +00:00
|
|
|
|
|
|
|
done:
|
2009-05-21 09:06:26 +00:00
|
|
|
displayDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Group::GenerateDisplayItems(void) {
|
|
|
|
if(displayDirty) {
|
|
|
|
displayMesh.Clear();
|
|
|
|
runningShell.TriangulateInto(&displayMesh);
|
|
|
|
displayEdges.Clear();
|
|
|
|
runningShell.MakeEdgesInto(&displayEdges);
|
|
|
|
displayDirty = false;
|
|
|
|
}
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 03:30:30 +00:00
|
|
|
SShell *Group::PreviousGroupShell(void) {
|
2008-06-06 08:14:37 +00:00
|
|
|
int i;
|
2009-04-19 05:53:16 +00:00
|
|
|
for(i = 0; i < SK.group.n; i++) {
|
|
|
|
Group *g = &(SK.group.elem[i]);
|
2008-06-06 08:14:37 +00:00
|
|
|
if(g->h.v == h.v) break;
|
|
|
|
}
|
2009-04-19 05:53:16 +00:00
|
|
|
if(i == 0 || i >= SK.group.n) oops();
|
|
|
|
return &(SK.group.elem[i-1].runningShell);
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Group::Draw(void) {
|
2009-05-21 09:06:26 +00:00
|
|
|
// Everything here gets drawn whether or not the group is hidden; we
|
|
|
|
// can control this stuff independently, with show/hide solids, edges,
|
|
|
|
// mesh, etc.
|
|
|
|
|
|
|
|
// Triangulate the shells if necessary.
|
|
|
|
GenerateDisplayItems();
|
2008-06-06 08:14:37 +00:00
|
|
|
|
|
|
|
int specColor;
|
2008-06-21 22:49:57 +00:00
|
|
|
if(type == DRAWING_3D || type == DRAWING_WORKPLANE) {
|
2008-06-06 08:14:37 +00:00
|
|
|
specColor = RGB(25, 25, 25); // force the color to something dim
|
|
|
|
} else {
|
|
|
|
specColor = -1; // use the model color
|
|
|
|
}
|
|
|
|
// The back faces are drawn in red; should never seem them, since we
|
|
|
|
// draw closed shells, so that's a debugging aid.
|
|
|
|
GLfloat mpb[] = { 1.0f, 0.1f, 0.1f, 1.0 };
|
|
|
|
glMaterialfv(GL_BACK, GL_AMBIENT_AND_DIFFUSE, mpb);
|
|
|
|
|
|
|
|
// When we fill the mesh, we need to know which triangles are selected
|
|
|
|
// or hovered, in order to draw them differently.
|
|
|
|
DWORD mh = 0, ms1 = 0, ms2 = 0;
|
|
|
|
hEntity he = SS.GW.hover.entity;
|
2009-04-19 05:53:16 +00:00
|
|
|
if(he.v != 0 && SK.GetEntity(he)->IsFace()) {
|
2008-06-06 08:14:37 +00:00
|
|
|
mh = he.v;
|
|
|
|
}
|
|
|
|
SS.GW.GroupSelection();
|
|
|
|
if(gs.faces > 0) ms1 = gs.face[0].v;
|
|
|
|
if(gs.faces > 1) ms2 = gs.face[1].v;
|
|
|
|
|
2008-07-06 07:56:24 +00:00
|
|
|
if(SS.GW.showShaded) {
|
|
|
|
glEnable(GL_LIGHTING);
|
2009-05-21 09:06:26 +00:00
|
|
|
glxFillMesh(specColor, &displayMesh, mh, ms1, ms2);
|
2008-07-06 07:56:24 +00:00
|
|
|
glDisable(GL_LIGHTING);
|
2009-03-18 04:26:04 +00:00
|
|
|
}
|
|
|
|
if(SS.GW.showEdges) {
|
2009-01-25 09:19:59 +00:00
|
|
|
glLineWidth(1);
|
|
|
|
glxDepthRangeOffset(2);
|
|
|
|
glxColor3d(REDf (SS.edgeColor),
|
|
|
|
GREENf(SS.edgeColor),
|
|
|
|
BLUEf (SS.edgeColor));
|
2009-05-21 09:06:26 +00:00
|
|
|
glxDrawEdges(&displayEdges);
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
|
|
|
|
2009-05-21 09:06:26 +00:00
|
|
|
if(SS.GW.showMesh) glxDebugMesh(&displayMesh);
|
2008-06-06 08:14:37 +00:00
|
|
|
|
2008-06-12 04:36:33 +00:00
|
|
|
// And finally show the polygons too
|
2008-06-06 08:14:37 +00:00
|
|
|
if(!SS.GW.showShaded) return;
|
2008-06-12 04:36:33 +00:00
|
|
|
if(polyError.how == POLY_NOT_CLOSED) {
|
2008-07-13 09:57:46 +00:00
|
|
|
// Report this error only in sketch-in-workplane groups; otherwise
|
|
|
|
// it's just a nuisance.
|
|
|
|
if(type == DRAWING_WORKPLANE) {
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
glxColor4d(1, 0, 0, 0.2);
|
|
|
|
glLineWidth(10);
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
glxVertex3v(polyError.notClosedAt.a);
|
|
|
|
glxVertex3v(polyError.notClosedAt.b);
|
|
|
|
glEnd();
|
|
|
|
glLineWidth(1);
|
|
|
|
glxColor3d(1, 0, 0);
|
|
|
|
glPushMatrix();
|
|
|
|
glxTranslatev(polyError.notClosedAt.b);
|
|
|
|
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
|
|
|
glxWriteText("not closed contour!");
|
|
|
|
glPopMatrix();
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
}
|
2009-01-23 03:30:30 +00:00
|
|
|
} else if(polyError.how == POLY_NOT_COPLANAR ||
|
|
|
|
polyError.how == POLY_SELF_INTERSECTING)
|
|
|
|
{
|
|
|
|
// These errors occur at points, not lines
|
2008-07-13 09:57:46 +00:00
|
|
|
if(type == DRAWING_WORKPLANE) {
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
glxColor3d(1, 0, 0);
|
|
|
|
glPushMatrix();
|
2009-01-23 03:30:30 +00:00
|
|
|
glxTranslatev(polyError.errorPointAt);
|
2008-07-13 09:57:46 +00:00
|
|
|
glxOntoWorkplane(SS.GW.projRight, SS.GW.projUp);
|
2009-01-23 03:30:30 +00:00
|
|
|
if(polyError.how == POLY_NOT_COPLANAR) {
|
|
|
|
glxWriteText("points not all coplanar!");
|
|
|
|
} else {
|
|
|
|
glxWriteText("contour is self-intersecting!");
|
|
|
|
}
|
2008-07-13 09:57:46 +00:00
|
|
|
glPopMatrix();
|
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
}
|
2008-06-06 08:14:37 +00:00
|
|
|
} else {
|
|
|
|
glxColor4d(0, 0.1, 0.1, 0.5);
|
2008-06-17 19:12:25 +00:00
|
|
|
glxDepthRangeOffset(1);
|
2008-06-06 08:14:37 +00:00
|
|
|
glxFillPolygon(&poly);
|
2008-06-17 19:12:25 +00:00
|
|
|
glxDepthRangeOffset(0);
|
2008-06-06 08:14:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|