Various tweaks, including a numerical improvement, to make the

epsilon in the csg stuff meaningfully apply everywhere to the
length.

[git-p4: depot-paths = "//depot/solvespace/": change = 1742]
solver
Jonathan Westhues 2008-05-25 06:36:03 -08:00
parent 248f74547e
commit 05b50e0af8
5 changed files with 7 additions and 6 deletions

View File

@ -83,7 +83,7 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
Vector gu = SS.GW.projUp.ScaledBy(1/SS.GW.scale);
Vector gn = (gr.Cross(gu)).WithMagnitude(1/SS.GW.scale);
glxColor3d(1, 0.4, 1);
glxColor3d(1, 0.1, 1);
switch(type) {
case PT_PT_DISTANCE: {
Vector ap = SS.GetEntity(ptA)->PointGetNum();

View File

@ -746,7 +746,7 @@ void Entity::DrawOrGetDistance(int order) {
break;
}
#define CIRCLE_SIDES(r) (7 + (int)(10*((sqrt(r))*SS.GW.scale)/20))
#define CIRCLE_SIDES(r) (7 + (int)(sqrt(r*SS.GW.scale)))
case ARC_OF_CIRCLE: {
if(order >= 0 && order != 1) break;
Vector c = SS.GetEntity(point[0])->PointGetNum();

View File

@ -320,7 +320,7 @@ SBsp3 *SBsp3::Insert(STriangle *tr, SMesh *instead) {
if(!this) {
// Brand new node; so allocate for it, and fill us in.
SBsp3 *r = Alloc();
r->n = tr->Normal();
r->n = (tr->Normal()).WithMagnitude(1);
r->d = (tr->a).Dot(r->n);
r->tri = *tr;
return r;
@ -501,7 +501,7 @@ SBsp2 *SBsp2::InsertEdge(SEdge *nedge, Vector nnp, Vector out) {
// Brand new node; so allocate for it, and fill us in.
SBsp2 *r = Alloc();
r->np = nnp;
r->no = (r->np).Cross((nedge->b).Minus(nedge->a));
r->no = ((r->np).Cross((nedge->b).Minus(nedge->a))).WithMagnitude(1);
if(out.Dot(r->no) < 0) {
r->no = (r->no).ScaledBy(-1);
}
@ -536,7 +536,7 @@ SBsp2 *SBsp2::InsertEdge(SEdge *nedge, Vector nnp, Vector out) {
SBsp2 *m = Alloc();
m->np = nnp;
m->no = (m->np).Cross((nedge->b).Minus(nedge->a));
m->no = ((m->np).Cross((nedge->b).Minus(nedge->a))).WithMagnitude(1);
if(out.Dot(m->no) < 0) {
m->no = (m->no).ScaledBy(-1);
}

View File

@ -296,6 +296,7 @@ void Group::CopyEntity(hEntity in, int a, hParam dx, hParam dy, hParam dz,
en.type = ep->type;
en.h = Remap(ep->h, a);
en.group = h;
en.construction = ep->construction;
switch(ep->type) {
case Entity::WORKPLANE:

View File

@ -299,7 +299,7 @@ Vector Vector::ScaledBy(double v) {
Vector Vector::WithMagnitude(double v) {
double m = Magnitude();
if(m < 0.001) {
if(m < LENGTH_EPS) {
return MakeFrom(v, 0, 0);
} else {
return ScaledBy(v/Magnitude());