Graphic3d_Group::Graphic3d_Group (const Handle(Graphic3d_Structure)& theStruct)
: myIsClosed (Standard_False)
{
- myBounds.XMin = ShortRealLast();
- myBounds.YMin = ShortRealLast();
- myBounds.ZMin = ShortRealLast();
- myBounds.XMax = ShortRealFirst();
- myBounds.YMax = ShortRealFirst();
- myBounds.ZMax = ShortRealFirst();
-
- //
// A small commentary on the usage of This!
//
// Graphic3d_Group is created in a structure. Graphic3d_Structure is a
ContextMarker.IsDef = 0,
ContextFillArea.IsDef = 0;
- myBounds.XMin = ShortRealLast();
- myBounds.YMin = ShortRealLast();
- myBounds.ZMin = ShortRealLast();
- myBounds.XMax = ShortRealFirst();
- myBounds.YMax = ShortRealFirst();
- myBounds.ZMax = ShortRealFirst();
+ myBounds.Clear();
if (MyContainsFacet)
{
Update();
- myBounds.XMin = ShortRealLast();
- myBounds.YMin = ShortRealLast();
- myBounds.ZMin = ShortRealLast();
- myBounds.XMax = ShortRealFirst();
- myBounds.YMax = ShortRealFirst();
- myBounds.ZMax = ShortRealFirst();
+ myBounds.Clear();
MyIsEmpty = Standard_True;
}
return Standard_True;
}
- const Standard_ShortReal RL = ShortRealLast();
- const Standard_ShortReal RF = ShortRealFirst();
- const Standard_Boolean isEmpty = ((myBounds.XMin == RL) && (myBounds.YMin == RL)
- && (myBounds.ZMin == RL) && (myBounds.XMax == RF)
- && (myBounds.YMax == RF) && (myBounds.ZMax == RF));
+ const Standard_Boolean isEmpty = myStructure->IsInfinite() ? Standard_False : !myBounds.IsValid();
if (isEmpty != MyIsEmpty)
{
::Message::DefaultMessenger()->Send ("Graphic3d_Group: MyIsEmpty != IsEmpty()", Message_Trace);
void Graphic3d_Group::SetMinMaxValues (const Standard_Real theXMin, const Standard_Real theYMin, const Standard_Real theZMin,
const Standard_Real theXMax, const Standard_Real theYMax, const Standard_Real theZMax)
{
- myBounds.XMin = Standard_ShortReal (theXMin);
- myBounds.YMin = Standard_ShortReal (theYMin);
- myBounds.ZMin = Standard_ShortReal (theZMin);
- myBounds.XMax = Standard_ShortReal (theXMax);
- myBounds.YMax = Standard_ShortReal (theYMax);
- myBounds.ZMax = Standard_ShortReal (theZMax);
+ myBounds.CornerMin() = Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theXMin),
+ static_cast<Standard_ShortReal> (theYMin),
+ static_cast<Standard_ShortReal> (theZMin),
+ 1.0f);
+ myBounds.CornerMax() = Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theXMax),
+ static_cast<Standard_ShortReal> (theYMax),
+ static_cast<Standard_ShortReal> (theZMax),
+ 1.0f);
}
// =======================================================================
theXMin = theYMin = theZMin = ShortRealFirst();
theXMax = theYMax = theZMax = ShortRealLast();
}
+ else if (myBounds.IsValid())
+ {
+ const Graphic3d_Vec4& aMinPt = myBounds.CornerMin();
+ const Graphic3d_Vec4& aMaxPt = myBounds.CornerMax();
+ theXMin = Standard_Real (aMinPt.x());
+ theYMin = Standard_Real (aMinPt.y());
+ theZMin = Standard_Real (aMinPt.z());
+ theXMax = Standard_Real (aMaxPt.x());
+ theYMax = Standard_Real (aMaxPt.y());
+ theZMax = Standard_Real (aMaxPt.z());
+ }
else
{
- theXMin = Standard_Real (myBounds.XMin);
- theYMin = Standard_Real (myBounds.YMin);
- theZMin = Standard_Real (myBounds.ZMin);
- theXMax = Standard_Real (myBounds.XMax);
- theYMax = Standard_Real (myBounds.YMax);
- theZMax = Standard_Real (myBounds.ZMax);
+ // for consistency with old API
+ theXMin = theYMin = theZMin = ShortRealLast();
+ theXMax = theYMax = theZMax = ShortRealFirst();
}
}
for (Standard_Integer aVertIter = 0; aVertIter < aNbVerts; ++aVertIter)
{
const Graphic3d_Vec2& aVert = *reinterpret_cast<const Graphic3d_Vec2* >(theAttribs->value (aVertIter) + anOffset);
- if (aVert.x() < myBounds.XMin) myBounds.XMin = aVert.x();
- if (aVert.y() < myBounds.YMin) myBounds.YMin = aVert.y();
- if (aVert.x() > myBounds.XMax) myBounds.XMax = aVert.x();
- if (aVert.y() > myBounds.YMax) myBounds.YMax = aVert.y();
+ myBounds.Add (Graphic3d_Vec4 (aVert.x(), aVert.y(), 0.0f, 1.0f));
}
break;
}
for (Standard_Integer aVertIter = 0; aVertIter < aNbVerts; ++aVertIter)
{
const Graphic3d_Vec3& aVert = *reinterpret_cast<const Graphic3d_Vec3* >(theAttribs->value (aVertIter) + anOffset);
- if (aVert.x() < myBounds.XMin) myBounds.XMin = aVert.x();
- if (aVert.y() < myBounds.YMin) myBounds.YMin = aVert.y();
- if (aVert.z() < myBounds.ZMin) myBounds.ZMin = aVert.z();
- if (aVert.x() > myBounds.XMax) myBounds.XMax = aVert.x();
- if (aVert.y() > myBounds.YMax) myBounds.YMax = aVert.y();
- if (aVert.z() > myBounds.ZMax) myBounds.ZMax = aVert.z();
+ myBounds.Add (Graphic3d_Vec4 (aVert.x(), aVert.y(), aVert.z(), 1.0f));
}
break;
}
{
Standard_ShortReal x, y, z;
thePoint.Coord (x, y, z);
- if (x < myBounds.XMin) myBounds.XMin = x;
- if (y < myBounds.YMin) myBounds.YMin = y;
- if (z < myBounds.ZMin) myBounds.ZMin = z;
- if (x > myBounds.XMax) myBounds.XMax = x;
- if (y > myBounds.YMax) myBounds.YMax = y;
- if (z > myBounds.ZMax) myBounds.ZMax = z;
+ myStructure->CStructure()->Is2dText = Standard_True;
+ myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (x),
+ static_cast<Standard_ShortReal> (y),
+ static_cast<Standard_ShortReal> (z),
+ 1.0f));
}
Update();
}
{
return myIsClosed;
}
+
+//=======================================================================
+//function : BoundingBox
+//purpose :
+//=======================================================================
+const Graphic3d_BndBox4f& Graphic3d_Group::BoundingBox() const
+{
+ return myBounds;
+}
+
+//=======================================================================
+//function : ChangeBoundingBox
+//purpose :
+//=======================================================================
+Graphic3d_BndBox4f& Graphic3d_Group::ChangeBoundingBox()
+{
+ return myBounds;
+}