Fix usage of uninitialized BBox.
This commit is contained in:
parent
cd6d891100
commit
bdd02ac3a8
@ -498,8 +498,7 @@ public:
|
|||||||
Vector minp;
|
Vector minp;
|
||||||
Vector maxp;
|
Vector maxp;
|
||||||
|
|
||||||
BBox();
|
static BBox From(const Vector &p0, const Vector &p1);
|
||||||
BBox(const Vector &p0, const Vector &p1);
|
|
||||||
|
|
||||||
Vector GetOrigin();
|
Vector GetOrigin();
|
||||||
Vector GetExtents();
|
Vector GetExtents();
|
||||||
|
@ -819,7 +819,7 @@ void Sketch::Clear(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BBox Sketch::CalculateEntityBBox(bool includingInvisible) {
|
BBox Sketch::CalculateEntityBBox(bool includingInvisible) {
|
||||||
BBox box;
|
BBox box = {};
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for(int i = 0; i < entity.n; i++) {
|
for(int i = 0; i < entity.n; i++) {
|
||||||
Entity *e = (Entity *)&entity.elem[i];
|
Entity *e = (Entity *)&entity.elem[i];
|
||||||
|
17
src/util.cpp
17
src/util.cpp
@ -1015,15 +1015,16 @@ bool Point2d::Equals(Point2d v, double tol) const {
|
|||||||
return (this->Minus(v)).MagSquared() < tol*tol;
|
return (this->Minus(v)).MagSquared() < tol*tol;
|
||||||
}
|
}
|
||||||
|
|
||||||
BBox::BBox() { }
|
BBox BBox::From(const Vector &p0, const Vector &p1) {
|
||||||
BBox::BBox(const Vector &p0, const Vector &p1) {
|
BBox bbox;
|
||||||
minp.x = min(p0.x, p1.x);
|
bbox.minp.x = min(p0.x, p1.x);
|
||||||
minp.y = min(p0.y, p1.y);
|
bbox.minp.y = min(p0.y, p1.y);
|
||||||
minp.z = min(p0.z, p1.z);
|
bbox.minp.z = min(p0.z, p1.z);
|
||||||
|
|
||||||
maxp.x = max(p0.x, p1.x);
|
bbox.maxp.x = max(p0.x, p1.x);
|
||||||
maxp.y = max(p0.y, p1.y);
|
bbox.maxp.y = max(p0.y, p1.y);
|
||||||
maxp.z = max(p0.z, p1.z);
|
bbox.maxp.z = max(p0.z, p1.z);
|
||||||
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector BBox::GetOrigin() { return minp.Plus(maxp.Minus(minp)).ScaledBy(0.5); }
|
Vector BBox::GetOrigin() { return minp.Plus(maxp.Minus(minp)).ScaledBy(0.5); }
|
||||||
|
Loading…
Reference in New Issue
Block a user