1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
nbv
c2fd3dc272 0023675: P-curves of a face are out of the domain of the face.
Analyzing of 2D-curves' boundaries.
Tolerance range computing was changed.

1. Function Validate(...) returns BRepCheck_Status.
2. For faces, whose pcurves is out of domain, status BRepCheck_OutOfSurfaceBoundary is returned.
3. For edges, which is out of face's boundary, status BRepCheck_PCurveIsOutOfDomainFace is returned.
4. Print warning, if status is not defined.
5. BRepCheck_Face::SetStatus(...) and BRepCheck_Wire::SetStatus(...) functions added.
6. ShapeFix::RefineFace(...) function and it draw-commands (ffixpcu and sfixpcu) are added. Command "ffixpcu" fixes a face with BRepCheck_OutOfSurfaceBoundary status. Command "sfixpcu" fixes a shape, which contains a face with BRepCheck_OutOfSurfaceBoundary status.
7. Trimming algorithm for surfaces changed (ForceTrim method is added).
8. Small correction of output of "checkshape" command result.
9. MinMax() and RealMod() functions are added.
10. Fixing of some shapes from test base.

Faces, which based on periodic or closed surfaces, are not controlled.
2014-04-03 12:08:15 +04:00
323 changed files with 20724 additions and 20912 deletions

View File

@@ -133,7 +133,9 @@ p FairCurve
p FilletSurf
p GccAna
p GccEnt
p GccGeo
p GccInt
p GccIter
p Geom2dAPI
p Geom2dGcc
p Geom2dHatch

View File

@@ -30,8 +30,10 @@ vsetcolorbg 255 255 255
vfit
# set ray tracing
puts "Trying raytrace mode..."
if { ! [catch {vraytrace 1}] } {
vtextureenv on 1
vsetraytracemode shad=1 refl=1 aa=1
if { [regexp {HAVE_OPENCL} [dversion]] } {
puts "Trying raytrace mode..."
if { ! [catch {vraytrace 1}] } {
vtextureenv on 1
vsetraytracemode shad=1 refl=1 aa=1
}
}

View File

@@ -325,7 +325,6 @@ is
class Triangulation;
imported ColoredShape;
imported TexturedShape;
class Drawer;

View File

@@ -1,460 +0,0 @@
// Created on: 2014-04-24
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AIS_ColoredShape.hxx>
#include <AIS_InteractiveContext.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <gp_Pnt2d.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Precision.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_Root.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Standard_ErrorHandler.hxx>
#include <StdPrs_ShadedShape.hxx>
#include <StdPrs_ToolShadedShape.hxx>
#include <StdPrs_WFDeflectionShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
IMPLEMENT_STANDARD_HANDLE (AIS_ColoredDrawer, AIS_Drawer)
IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredDrawer, AIS_Drawer)
IMPLEMENT_STANDARD_HANDLE (AIS_ColoredShape, AIS_Shape)
IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredShape, AIS_Shape)
//=======================================================================
//function : AIS_ColoredShape
//purpose :
//=======================================================================
AIS_ColoredShape::AIS_ColoredShape (const TopoDS_Shape& theShape)
: AIS_Shape (theShape)
{
// disable dedicated line aspects
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
}
//=======================================================================
//function : AIS_ColoredShape
//purpose :
//=======================================================================
AIS_ColoredShape::AIS_ColoredShape (const Handle(AIS_Shape)& theShape)
: AIS_Shape (theShape->Shape())
{
// disable dedicated line aspects
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
if (theShape->HasMaterial())
{
SetMaterial (theShape->Material());
}
if (theShape->HasColor())
{
SetColor (theShape->Color());
}
if (theShape->HasWidth())
{
SetWidth (theShape->Width());
}
if (theShape->IsTransparent())
{
SetTransparency (theShape->Transparency());
}
}
//=======================================================================
//function : CustomAspects
//purpose :
//=======================================================================
Handle(AIS_ColoredDrawer) AIS_ColoredShape::CustomAspects (const TopoDS_Shape& theShape)
{
Handle(AIS_ColoredDrawer) aDrawer;
myShapeColors.Find (theShape, aDrawer);
if (aDrawer.IsNull())
{
aDrawer = new AIS_ColoredDrawer (myDrawer);
myShapeColors.Bind (theShape, aDrawer);
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
}
return aDrawer;
}
//=======================================================================
//function : ClearCustomAspects
//purpose :
//=======================================================================
void AIS_ColoredShape::ClearCustomAspects()
{
if (myShapeColors.IsEmpty())
{
return;
}
myShapeColors.Clear();
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
}
//=======================================================================
//function : UnsetCustomAspects
//purpose :
//=======================================================================
void AIS_ColoredShape::UnsetCustomAspects (const TopoDS_Shape& theShape,
const Standard_Boolean theToUnregister)
{
if (!myShapeColors.IsBound (theShape))
{
return;
}
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
if (theToUnregister)
{
myShapeColors.UnBind (theShape);
return;
}
myShapeColors.ChangeFind (theShape) = new AIS_ColoredDrawer (myDrawer);
}
//=======================================================================
//function : SetCustomColor
//purpose :
//=======================================================================
void AIS_ColoredShape::SetCustomColor (const TopoDS_Shape& theShape,
const Quantity_Color& theColor)
{
if (theShape.IsNull())
{
return;
}
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
setColor (aDrawer, theColor);
aDrawer->SetOwnColor (theColor);
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
}
//=======================================================================
//function : SetCustomWidth
//purpose :
//=======================================================================
void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
const Standard_Real theLineWidth)
{
if (theShape.IsNull())
{
return;
}
const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
setWidth (CustomAspects (theShape), theLineWidth);
aDrawer->SetOwnWidth (theLineWidth);
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
}
//=======================================================================
//function : SetColor
//purpose :
//=======================================================================
void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
{
setColor (myDrawer, theColor);
myOwnColor = theColor;
hasOwnColor = Standard_True;
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
if (aDrawer->HasOwnColor())
{
continue;
}
if (aDrawer->HasShadingAspect())
{
aDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
}
if (aDrawer->HasLineAspect())
{
aDrawer->LineAspect()->SetColor (theColor);
}
if (aDrawer->HasWireAspect())
{
aDrawer->WireAspect()->SetColor (theColor);
}
}
}
//=======================================================================
//function : SetWidth
//purpose :
//=======================================================================
void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
{
setWidth (myDrawer, theLineWidth);
myOwnWidth = theLineWidth;
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
if (aDrawer->HasOwnWidth())
{
continue;
}
if (aDrawer->HasLineAspect())
{
aDrawer->LineAspect()->SetWidth (theLineWidth);
}
if (aDrawer->HasWireAspect())
{
aDrawer->WireAspect()->SetWidth (theLineWidth);
}
}
}
//=======================================================================
//function : SetTransparency
//purpose :
//=======================================================================
void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
{
setTransparency (myDrawer, theValue);
myTransparency = theValue;
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (AIS_Shaded);
for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_Drawer)& aDrawer = anIter.Value();
if (aDrawer->HasShadingAspect())
{
aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
}
}
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
thePrs->Clear();
if (IsInfinite())
{
thePrs->SetInfiniteState (Standard_True);
}
const Standard_Boolean isClosed = StdPrs_ToolShadedShape::IsClosed (myshape);
if (theMode == AIS_Shaded)
{
// compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
|| (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
{
BRepTools::Clean (myshape);
}
StdPrs_ShadedShape::Tessellate (myshape, myDrawer);
}
// 1) myShapeColors + myshape --> array[TopAbs_ShapeEnum] of map of color-to-compound
DataMapOfShapeCompd aTypeKeyshapeDrawshapeArray[(size_t )TopAbs_SHAPE];
dispatchColors (myshape, myShapeColors, aTypeKeyshapeDrawshapeArray);
// 2) finally add appropriate presentations (1 color -- 1 compound) according to theMode
Handle(AIS_ColoredDrawer) aCustomDrawer;
for (size_t aShType = 0; aShType < (size_t )TopAbs_SHAPE; ++aShType)
{
DataMapOfShapeCompd& aKeyshapeDrawshapeMap = aTypeKeyshapeDrawshapeArray[aShType];
for (DataMapOfShapeCompd::Iterator aMapIter (aKeyshapeDrawshapeMap);
aMapIter.More(); aMapIter.Next())
{
const TopoDS_Shape& aShapeKey = aMapIter.Key(); // key shape with detailed color or a base shape
const TopoDS_Compound& aShapeDraw = aMapIter.Value(); // compound of subshapes with <aShType> type
Handle(AIS_Drawer) aDrawer = !myShapeColors.Find (aShapeKey, aCustomDrawer) ? myDrawer : aCustomDrawer;
// Draw each kind of subshapes and personal-colored shapes in a separate group
// since it's necessary to set transparency/material for all subshapes
// without affecting their unique colors
Handle(Graphic3d_Group) aCurrGroup = Prs3d_Root::NewGroup (thePrs);
switch (theMode)
{
default:
case AIS_Shaded:
{
if ((Standard_Integer )aShapeDraw.ShapeType() <= TopAbs_FACE
&& !IsInfinite())
{
StdPrs_ShadedShape::Add (thePrs, aShapeDraw, aDrawer);
aDrawer->SetShadingAspectGlobal (Standard_False);
Handle(Graphic3d_AspectFillArea3d) anAsp = aDrawer->ShadingAspect()->Aspect();
isClosed ? anAsp->SuppressBackFace() : anAsp->AllowBackFace();
aCurrGroup->SetGroupPrimitivesAspect (anAsp);
break;
}
// compute wire-frame otherwise
}
case AIS_WireFrame:
{
StdPrs_WFDeflectionShape::Add (thePrs, aShapeDraw, aDrawer);
break;
}
}
}
}
}
//=======================================================================
//function : dispatchColors
//purpose :
//=======================================================================
Standard_Boolean AIS_ColoredShape::dispatchColors (const TopoDS_Shape& theBaseKey,
const TopoDS_Shape& theSubshapeToParse,
const DataMapOfShapeShape& theSubshapeKeyshapeMap,
const TopAbs_ShapeEnum theParentType,
DataMapOfShapeCompd* theTypeKeyshapeDrawshapeArray)
{
TopAbs_ShapeEnum aShType = theSubshapeToParse.ShapeType();
if (aShType == TopAbs_SHAPE)
{
return Standard_False;
}
// check own setting of current shape
TopoDS_Shape aKeyShape = theBaseKey;
Standard_Boolean isOverriden = theSubshapeKeyshapeMap.Find (theSubshapeToParse, aKeyShape);
// iterate on sub-shapes
BRep_Builder aBBuilder;
TopoDS_Shape aShapeCopy = theSubshapeToParse.EmptyCopied();
Standard_Boolean isSubOverride = Standard_False;
Standard_Integer nbDef = 0;
for (TopoDS_Iterator it (theSubshapeToParse); it.More(); it.Next())
{
if (dispatchColors (theBaseKey, it.Value(),
theSubshapeKeyshapeMap, aShType,
theTypeKeyshapeDrawshapeArray))
{
isSubOverride = Standard_True;
}
else
{
aBBuilder.Add (aShapeCopy, it.Value());
++nbDef;
}
}
if (aShType == TopAbs_FACE || !isSubOverride)
{
aShapeCopy = theSubshapeToParse;
}
else if (nbDef == 0)
{
return isOverriden || isSubOverride; // empty compound
}
// if any of styles is overridden regarding to default one, add rest to map
if (isOverriden
|| (isSubOverride && theParentType != TopAbs_WIRE // avoid drawing edges when vertex color is overridden
&& theParentType != TopAbs_FACE) // avoid drawing edges of the same color as face
|| (theParentType == TopAbs_SHAPE && !(isOverriden || isSubOverride))) // bind original shape to default color
{
TopoDS_Compound aCompound;
DataMapOfShapeCompd& aKeyshapeDrawshapeMap = theTypeKeyshapeDrawshapeArray[(size_t )aShType];
if (!aKeyshapeDrawshapeMap.FindFromKey (aKeyShape, aCompound))
{
aBBuilder.MakeCompound (aCompound);
aKeyshapeDrawshapeMap.Add (aKeyShape, aCompound);
}
aBBuilder.Add (aCompound, aShapeCopy);
}
return isOverriden || isSubOverride;
}
//=======================================================================
//function : dispatchColors
//purpose :
//=======================================================================
void AIS_ColoredShape::dispatchColors (const TopoDS_Shape& theBaseShape,
const DataMapOfShapeColor& theKeyshapeColorMap,
DataMapOfShapeCompd* theTypeKeyshapeDrawshapeArray)
{
// Extract <theShapeColors> map (KeyshapeColored -> Color)
// to subshapes map (Subshape -> KeyshapeColored).
// This needed when colored shape is not part of <theBaseShape>
// (but subshapes are) and actually container for subshapes.
DataMapOfShapeShape aSubshapeKeyshapeMap;
for (DataMapOfShapeColor::Iterator anIt (theKeyshapeColorMap);
anIt.More(); anIt.Next())
{
const TopoDS_Shape& aSh = anIt.Key();
TopAbs_ShapeEnum aType = aSh.ShapeType();
TopAbs_ShapeEnum aSubType = (aType == TopAbs_SOLID || aType == TopAbs_SHELL)
? TopAbs_FACE
: (aType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_SHAPE);
switch (aSubType)
{
case TopAbs_SHAPE:
{
aSubshapeKeyshapeMap.Bind (aSh, aSh);
break;
}
default:
{
for (TopExp_Explorer anExp (aSh, aSubType); anExp.More(); anExp.Next())
{
if (!aSubshapeKeyshapeMap.IsBound (anExp.Current()))
{
aSubshapeKeyshapeMap.Bind (anExp.Current(), aSh);
}
}
}
}
}
// Fill the array of maps per shape type
dispatchColors (theBaseShape, theBaseShape,
aSubshapeKeyshapeMap, TopAbs_SHAPE,
theTypeKeyshapeDrawshapeArray);
}

View File

@@ -1,145 +0,0 @@
// Created on: 2014-04-24
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ColoredShape_HeaderFile
#define _AIS_ColoredShape_HeaderFile
#include <AIS_Drawer.hxx>
#include <AIS_Shape.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_IndexedDataMap.hxx>
#include <TopTools_ShapeMapHasher.hxx>
#include <TopoDS_Compound.hxx>
//! Customizable properties.
class AIS_ColoredDrawer : public AIS_Drawer
{
public:
AIS_ColoredDrawer (const Handle(AIS_Drawer)& theLink)
: myHasOwnColor (Standard_False),
myHasOwnWidth (Standard_False)
{
Link (theLink);
}
Standard_Boolean HasOwnColor() const { return myHasOwnColor; }
void UnsetOwnColor() { myHasOwnColor = Standard_False; }
void SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = Standard_True; }
Standard_Boolean HasOwnWidth() const { return myHasOwnWidth; }
void UnsetOwnWidth() { myHasOwnWidth = Standard_False; }
void SetOwnWidth (const Standard_Real /*theWidth*/) { myHasOwnWidth = Standard_True; }
public: //! @name list of overridden properties
Standard_Boolean myHasOwnColor;
Standard_Boolean myHasOwnWidth;
public:
DEFINE_STANDARD_RTTI(AIS_ColoredDrawer);
};
DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, AIS_Drawer)
//! Presentation of the shape with customizable sub-shapes properties.
class AIS_ColoredShape : public AIS_Shape
{
public:
//! Default constructor
Standard_EXPORT AIS_ColoredShape (const TopoDS_Shape& theShape);
//! Copy constructor
Standard_EXPORT AIS_ColoredShape (const Handle(AIS_Shape)& theShape);
public: //! @name sub-shape aspects
//! Customize properties of specified sub-shape.
//! The shape will be stored in the map but ignored, if it is not sub-shape of main Shape!
//! This method can be used to mark sub-shapes with customizable properties.
Standard_EXPORT Handle(AIS_ColoredDrawer) CustomAspects (const TopoDS_Shape& theShape);
//! Reset the map of custom sub-shape aspects.
Standard_EXPORT void ClearCustomAspects();
//! Reset custom properties of specified sub-shape.
//! @param theToUnregister unregister or not sub-shape from the map
Standard_EXPORT void UnsetCustomAspects (const TopoDS_Shape& theShape,
const Standard_Boolean theToUnregister = Standard_False);
//! Customize color of specified sub-shape
Standard_EXPORT void SetCustomColor (const TopoDS_Shape& theShape,
const Quantity_Color& theColor);
//! Customize line width of specified sub-shape
Standard_EXPORT void SetCustomWidth (const TopoDS_Shape& theShape,
const Standard_Real theLineWidth);
public: //! @name global aspects
//! Setup color of entire shape.
Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor);
//! Setup line width of entire shape.
Standard_EXPORT virtual void SetWidth (const Standard_Real theLineWidth);
//! Sets transparency value.
Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue);
protected: //! @name override presentation computation
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode);
protected:
typedef NCollection_DataMap<TopoDS_Shape, Handle(AIS_ColoredDrawer), TopTools_ShapeMapHasher> DataMapOfShapeColor;
typedef NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> DataMapOfShapeShape;
typedef NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Compound, TopTools_ShapeMapHasher> DataMapOfShapeCompd;
protected:
//! Recursive function to map shapes.
//! @param theBaseKey the key to be used for undetailed shapes (default colors)
//! @param theSubshapeToParse the subshape to be parsed
//! @param theSubshapeKeyshapeMap shapes map Subshape (in the base shape) -> Keyshape (detailed shape)
//! @param theParentType the parent subshape type
//! @param theTypeKeyshapeDrawshapeArray the array of shape types to fill
Standard_EXPORT static Standard_Boolean dispatchColors (const TopoDS_Shape& theBaseKey,
const TopoDS_Shape& theSubshapeToParse,
const DataMapOfShapeShape& theSubshapeKeyshapeMap,
const TopAbs_ShapeEnum theParentType,
DataMapOfShapeCompd* theTypeKeyshapeDrawshapeArray);
Standard_EXPORT static void dispatchColors (const TopoDS_Shape& theBaseShape,
const DataMapOfShapeColor& theKeyshapeColorMap,
DataMapOfShapeCompd* theTypeKeyshapeDrawshapeArray);
protected:
DataMapOfShapeColor myShapeColors;
public:
DEFINE_STANDARD_RTTI(AIS_ColoredShape);
};
DEFINE_STANDARD_HANDLE(AIS_ColoredShape, AIS_Shape)
#endif // _AIS_ColoredShape_HeaderFile

View File

@@ -22,7 +22,7 @@
#include <Geom_Transformation.hxx>
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_Presentation.hxx>
#include <PrsMgr_Presentation3d.hxx>
#include <OSD_Timer.hxx>
@@ -84,19 +84,18 @@ Connect(const Handle(AIS_InteractiveObject)& anotherIobj,
//=======================================================================
//function : Disconnect
//purpose :
//purpose :
//=======================================================================
void AIS_ConnectedInteractive::Disconnect()
{
for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
{
const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation();
if (!aPrs.IsNull())
for(Standard_Integer i =1;i<=myPresentations.Length();i++)
{
aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT);
Handle(PrsMgr_Presentation3d) P = Handle(PrsMgr_Presentation3d)::DownCast(myPresentations(i).Presentation());
if(!P.IsNull()) {
P->Presentation()->DisconnectAll(Graphic3d_TOC_DESCENDANT);
}
}
}
}
//=======================================================================
//function : Compute

View File

@@ -15,136 +15,86 @@
// commercial license or contractual agreement.
inline Standard_Boolean AIS_Drawer::WasLastLocal() const
{
return Standard_False;
}
{return Standard_False;}
inline Standard_Boolean AIS_Drawer::HasLocalAttributes() const
{
return hasLocalAttributes;
}
inline Standard_Boolean AIS_Drawer::HasLocalAttributes() const
{return hasLocalAttributes;}
inline Standard_Real AIS_Drawer::PreviousDeviationCoefficient() const
{
return myhasOwnDeviationCoefficient ? myPreviousDeviationCoefficient : 0.0;
}
inline Standard_Real AIS_Drawer::PreviousDeviationCoefficient () const
{return (myhasOwnDeviationCoefficient) ? myPreviousDeviationCoefficient : 0.0;}
inline Standard_Real AIS_Drawer::PreviousHLRDeviationCoefficient() const
{
return myhasOwnHLRDeviationCoefficient ? myPreviousHLRDeviationCoefficient : 0.0;
}
inline Standard_Real AIS_Drawer::PreviousHLRDeviationCoefficient () const
{return (myhasOwnHLRDeviationCoefficient) ? myPreviousHLRDeviationCoefficient : 0.0;}
inline Standard_Real AIS_Drawer::PreviousDeviationAngle() const
{
return myhasOwnDeviationAngle ? myPreviousDeviationAngle : 0.0;
}
inline Standard_Real AIS_Drawer::PreviousDeviationAngle () const
{return (myhasOwnDeviationAngle) ? myPreviousDeviationAngle : 0.0;}
inline Standard_Real AIS_Drawer::PreviousHLRDeviationAngle() const
{
return myhasOwnHLRDeviationAngle ? myPreviousHLRDeviationAngle : 0.0;
}
inline Standard_Real AIS_Drawer::PreviousHLRDeviationAngle () const
{return (myhasOwnHLRDeviationAngle) ? myPreviousHLRDeviationAngle : 0.0;}
inline void AIS_Drawer::Link (const Handle(Prs3d_Drawer)& theDrawer)
{
myLink = theDrawer;
}
inline void AIS_Drawer::Link ( const Handle(Prs3d_Drawer)& aDrawer)
{ myLink = aDrawer;}
inline Standard_Boolean AIS_Drawer::HasLink() const
{
return !myLink.IsNull();
}
{ return ! myLink.IsNull();}
inline void AIS_Drawer::SetDeviationCoefficient()
{
myhasOwnDeviationCoefficient = Standard_False;
}
inline void AIS_Drawer::SetDeviationCoefficient ()
{ myhasOwnDeviationCoefficient = Standard_False; }
inline void AIS_Drawer::SetHLRDeviationCoefficient()
{
myhasOwnHLRDeviationCoefficient = Standard_False;
}
inline void AIS_Drawer::SetHLRDeviationCoefficient ()
{ myhasOwnHLRDeviationCoefficient = Standard_False; }
inline void AIS_Drawer::SetDeviationAngle()
{
myhasOwnDeviationAngle = Standard_False;
}
inline void AIS_Drawer::SetDeviationAngle ()
{ myhasOwnDeviationAngle = Standard_False;}
inline void AIS_Drawer::SetHLRAngle()
{
myhasOwnHLRDeviationAngle = Standard_False;
}
inline void AIS_Drawer::SetHLRAngle ()
{ myhasOwnHLRDeviationAngle = Standard_False;}
inline Standard_Boolean AIS_Drawer::IsOwnDeviationCoefficient() const
{
return myhasOwnDeviationCoefficient;
}
inline Standard_Boolean AIS_Drawer::IsOwnDeviationCoefficient () const
{ return myhasOwnDeviationCoefficient;}
inline Standard_Boolean AIS_Drawer::IsOwnDeviationAngle() const
{
return myhasOwnDeviationAngle;
}
inline Standard_Boolean AIS_Drawer::IsOwnDeviationAngle () const
{ return myhasOwnDeviationAngle;}
inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationCoefficient() const
{
return myhasOwnHLRDeviationCoefficient;
}
inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationCoefficient () const
{ return myhasOwnHLRDeviationCoefficient;}
inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationAngle() const
{
return myhasOwnHLRDeviationAngle;
}
inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationAngle () const
{ return myhasOwnHLRDeviationAngle;}
inline Standard_Boolean AIS_Drawer::HasTextAspect() const
{
return !myTextAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasTextAspect () const
{ return (!myTextAspect.IsNull());}
inline Standard_Boolean AIS_Drawer::HasWireAspect() const
{
return !myWireAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasWireAspect () const
{ return (!myWireAspect.IsNull());}
inline Standard_Boolean AIS_Drawer::HasLineAspect() const
{
return !myLineAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasLineAspect () const
{return !myLineAspect.IsNull(); }
inline Standard_Boolean AIS_Drawer::HasShadingAspect() const
{
return !myShadingAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasShadingAspect () const
{ return !myShadingAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasPointAspect() const
{
return !myPointAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasPointAspect () const
{ return !myPointAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasDatumAspect() const
{
return !myDatumAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasDatumAspect () const
{ return !myDatumAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasPlaneAspect() const
{
return !myPlaneAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::HasPlaneAspect () const
{ return !myPlaneAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw() const
{
return myHasOwnFaceBoundaryDraw;
}
inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw () const
{ return myHasOwnFaceBoundaryDraw; }
inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryAspect() const
{
return !myFaceBoundaryAspect.IsNull();
}
inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryAspect () const
{ return !myFaceBoundaryAspect.IsNull (); }
inline void AIS_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
inline void AIS_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
{
myTypeOfHLR = theTypeOfHLR;
}
inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR() const
inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR ( ) const
{
return (myTypeOfHLR == Prs3d_TOH_NotSet) ? myLink->TypeOfHLR() : myTypeOfHLR;
}

View File

@@ -179,9 +179,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
// does nothing if previously detected object is equal to the current one
if (myMainSel->OnePicked()->Selectable() == myLastPicked)
{
return myLastPicked->State() == 1
? AIS_SOD_Selected
: AIS_SOD_OnlyOneDetected;
return AIS_SOD_OnlyOneDetected;
}
// Previously detected object is unhilighted if it is not selected or hilighted
@@ -218,9 +216,10 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
toUpdateViewer = Standard_True;
}
aStatus = myLastPicked->State() == 1
? AIS_SOD_Selected
: AIS_SOD_OnlyOneDetected;
if (myLastPicked->State() == 1)
{
aStatus = AIS_SOD_Selected;
}
}
}
else
@@ -244,7 +243,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
}
myLastinMain.Nullify();
myLastPicked.Nullify();
}
if (toUpdateViewer)
@@ -259,6 +257,7 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
}
}
myLastPicked.Nullify();
mylastmoveview = theView;
return aStatus;
}

View File

@@ -23,9 +23,16 @@
// instead a restricted object NameOfColor.
// Add SetCurrentFacingModel() method
#define IMP020200 //GG Add SetTransformation() method
#define IMP140200 //GG Add HasPresentation() and Presentation() methods
// Add SetAspect() method.
#define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode()
// method, compute only authorized presentation.
#define IMP220501 //GG CADPAK_V2 Update selection properly
#define OCC708 //SAV unsetting transformation correctly
#include <AIS_InteractiveObject.ixx>
@@ -543,31 +550,33 @@ void AIS_InteractiveObject::SetInfiniteState(const Standard_Boolean aFlag)
P->SetInfiniteState(myInfiniteState);}
}
#ifdef IMP020200
//=======================================================================
//function : SetTransformation
//purpose :
//purpose :
//=======================================================================
void AIS_InteractiveObject::SetTransformation (const Handle(Geom_Transformation)& theTrsf,
const Standard_Boolean theToPostConcatenate,
const Standard_Boolean theToUpdateSelection)
{
if (GetContext().IsNull())
{
return;
}
void AIS_InteractiveObject::SetTransformation(const Handle(Geom_Transformation)& aTrsf, const Standard_Boolean postConcatenate, const Standard_Boolean updateSelection) {
const PrsMgr_Presentations& aPrsList = Presentations();
myHasTransformation = Standard_True;
for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter)
{
const Standard_Integer aMode = aPrsList (aPrsIter).Mode();
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, aMode)->Presentation();
theToPostConcatenate ? aPrs->Multiply (theTrsf)
: aPrs->Transform (theTrsf);
if (theToUpdateSelection)
{
myCTXPtr->ClearSelected (Standard_True);
myCTXPtr->RecomputeSelectionOnly (this);
if(!GetContext().IsNull()){
const PrsMgr_Presentations& prs = Presentations();
Handle(Prs3d_Presentation) P;
Standard_Integer mode;
myHasTransformation = Standard_True;
for( Standard_Integer i=1 ; i<=prs.Length() ; i++ ) {
mode = prs(i).Mode();
P = GetContext()->MainPrsMgr()->CastPresentation(this,mode)->Presentation();
if( postConcatenate ) P->Multiply(aTrsf);
else P->Transform(aTrsf);
if( updateSelection ) {
#ifdef IMP220501
myCTXPtr->ClearSelected(Standard_True);
myCTXPtr->RecomputeSelectionOnly(this);
#else
if( HasSelection(mode) ) {
UpdateSelection(mode);
}
#endif
}
}
}
}
@@ -589,22 +598,21 @@ Handle(Geom_Transformation) trsf;
//=======================================================================
//function : Transformation
//purpose :
//purpose :
//=======================================================================
Handle(Geom_Transformation) AIS_InteractiveObject::Transformation()
{
if (GetContext().IsNull())
{
return Handle(Geom_Transformation)();
Handle(Geom_Transformation) AIS_InteractiveObject::Transformation() {
Handle(Geom_Transformation) trsf;
if(!GetContext().IsNull() ) {
const PrsMgr_Presentations& prs = Presentations();
if( prs.Length() > 0 ) {
Handle(Prs3d_Presentation) P =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
trsf = P->Transformation();
}
}
const PrsMgr_Presentations& aPrsList = Presentations();
if (aPrsList.Length() > 0)
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, 1)->Presentation();
return aPrs->Transformation();
}
return Handle(Geom_Transformation)();
return trsf;
}
//=======================================================================
@@ -615,26 +623,36 @@ Standard_Boolean AIS_InteractiveObject::HasTransformation() const {
return myHasTransformation;
}
#endif
#ifdef IMP140200
//=======================================================================
//function : HasPresentation
//purpose :
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveObject::HasPresentation() const
{
return !GetContext().IsNull()
&& GetContext()->MainPrsMgr()->HasPresentation (this, myDisplayMode);
Standard_Boolean AIS_InteractiveObject::HasPresentation() const {
if( !GetContext().IsNull() &&
GetContext()->MainPrsMgr()->HasPresentation(this,myDisplayMode) ) {
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : Presentation
//purpose :
//purpose :
//=======================================================================
Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const
{
return HasPresentation()
? GetContext()->MainPrsMgr()->Presentation (this, myDisplayMode)->Presentation()
: Handle(Prs3d_Presentation)();
Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const {
Handle(Prs3d_Presentation) prs;
if( HasPresentation() ) {
prs = GetContext()->MainPrsMgr()->
CastPresentation(this,myDisplayMode)->Presentation();
}
return prs;
}
//=======================================================================
@@ -680,6 +698,9 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& anAspect,
}
}
}
#endif
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
//=======================================================================
//function : SetPolygonOffsets
@@ -695,11 +716,12 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode, aFactor, aUnits );
// Modify existing presentations
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation();
Handle(Graphic3d_Structure) aStruct;
for( Standard_Integer i = 1, n = myPresentations.Length(); i <= n; i++ ) {
Handle(PrsMgr_Presentation3d) aPrs3d =
Handle(PrsMgr_Presentation3d)::DownCast( myPresentations(i).Presentation() );
if ( !aPrs3d.IsNull() ) {
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
aStruct = Handle(Graphic3d_Structure)::DownCast( aPrs3d->Presentation() );
if( !aStruct.IsNull() ) {
aStruct->SetPrimitivesAspect( myDrawer->ShadingAspect()->Aspect() );
// Workaround for issue 23115: Need to update also groups, because their
@@ -728,6 +750,7 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
}
}
//=======================================================================
//function : HasPolygonOffsets
//purpose :
@@ -750,3 +773,4 @@ void AIS_InteractiveObject::PolygonOffsets(Standard_Integer& aMode,
if( HasPolygonOffsets() )
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode, aFactor, aUnits );
}
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets

View File

@@ -1195,7 +1195,7 @@ Standard_Boolean AIS_LocalContext::ImmediateAdd (const Handle(AIS_InteractiveObj
return Standard_False;
}
myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation());
myMainPM->AddToImmediateList (myMainPM->CastPresentation (theObj, theMode)->Presentation());
return Standard_True;
}

View File

@@ -22,7 +22,7 @@
#include <AIS_MultipleConnectedInteractive.ixx>
#include <PrsMgr_ModedPresentation.hxx>
#include <PrsMgr_Presentation.hxx>
#include <PrsMgr_Presentation3d.hxx>
static Standard_Boolean IsInSeq (const AIS_SequenceOfInteractive& theSeq,
const Handle(AIS_InteractiveObject)& theItem)
@@ -113,12 +113,11 @@ void AIS_MultipleConnectedInteractive::Disconnect(const Handle(AIS_InteractiveOb
void AIS_MultipleConnectedInteractive::DisconnectAll ()
{
/* for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter)
/* for(Standard_Integer i =1;i<=myPresentations.Length();i++)
{
const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation();
if (!aPrs.IsNull())
{
aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT);
Handle(PrsMgr_Presentation3d) P = Handle(PrsMgr_Presentation3d)::DownCast(myPresentations(i).Presentation());
if(!P.IsNull()) {
P->Presentation()->DisconnectAll(Graphic3d_TOC_DESCENDANT);
}
}*/
myPreviousReferences = myReferences; // pour garder les poignees au chaud!!!!

View File

@@ -61,7 +61,6 @@ uses
Projector from Prs3d,
PresentationManager3d from PrsMgr,
Selection from SelectMgr,
Drawer from AIS,
KindOfInteractive from AIS,
Transformation from Geom,
Drawer from Prs3d,
@@ -299,21 +298,7 @@ uses
aBox : Box from Bnd;
aDrawer : Drawer from Prs3d) is protected;
setColor (me;
theDrawer : Drawer from AIS;
theColor : Color from Quantity)
is protected;
setWidth (me;
theDrawer : Drawer from AIS;
theWidth : Real from Standard)
is protected;
setTransparency (me;
theDrawer : Drawer from AIS;
theValue : Real from Standard)
is protected;
fields
myshape : Shape from TopoDS is protected;
myBB : Box from Bnd is protected;

View File

@@ -215,15 +215,23 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
case 1:
{
Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev);
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev);
if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
|| (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion()))
{
BRepTools::Clean (myshape);
Standard_Real prevangle ;
Standard_Real newangle ;
Standard_Real prevcoeff ;
Standard_Real newcoeff ;
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
#ifdef DEB
cout << "AIS_Shape : compute"<<endl;
cout << "newangl : " << newangle << " # de " << "prevangl : " << prevangle << " OU "<<endl;
cout << "newcoeff : " << newcoeff << " # de " << "prevcoeff : " << prevcoeff << endl;
#endif
BRepTools::Clean(myshape);
}
//shading only on face...
if ((Standard_Integer) myshape.ShapeType()>4)
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
@@ -487,212 +495,135 @@ void AIS_Shape::SetColor(const Quantity_NameOfColor aCol)
SetColor(Quantity_Color(aCol));
}
//=======================================================================
//function : setColor
//purpose :
//=======================================================================
void AIS_Shape::setColor (const Handle(AIS_Drawer)& theDrawer,
const Quantity_Color& theColor) const
{
if (!theDrawer->HasShadingAspect())
{
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
if (!theDrawer->HasLineAspect())
{
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
}
if (!theDrawer->HasWireAspect())
{
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
}
if (!theDrawer->HasPointAspect())
{
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
*theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
}
// disable dedicated line aspects
theDrawer->SetFreeBoundaryAspect (theDrawer->LineAspect());
theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect());
theDrawer->SetSeenLineAspect (theDrawer->LineAspect());
// override color
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
theDrawer->SetShadingAspectGlobal (Standard_False);
theDrawer->LineAspect()->SetColor (theColor);
theDrawer->WireAspect()->SetColor (theColor);
theDrawer->PointAspect()->SetColor (theColor);
}
//=======================================================================
//function : SetColor
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::SetColor (const Quantity_Color& theColor)
void AIS_Shape::SetColor(const Quantity_Color &aCol)
{
setColor (myDrawer, theColor);
myOwnColor = theColor;
if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
hasOwnColor = Standard_True;
myDrawer->ShadingAspect()->SetColor(aCol,myCurrentFacingModel);
myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
myDrawer->SetShadingAspectGlobal(Standard_False);
const Standard_Real WW = HasWidth()? Width():AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line);
myDrawer->SetLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
myDrawer->SetWireAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
myDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
myDrawer->SetUnFreeBoundaryAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
myDrawer->SetSeenLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
// fast shading modification...
if (!GetContext().IsNull())
{
if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, AIS_Shaded)->Presentation();
Handle(Graphic3d_Group) aCurGroup = Prs3d_Root::CurrentGroup (aPrs);
if(!GetContext().IsNull()){
if( GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) aPresentation =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) aCurGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
// Set aspects for presentation and for group
aPrs->SetPrimitivesAspect (anAreaAspect);
aPrs->SetPrimitivesAspect (aLineAspect);
aPrs->SetPrimitivesAspect (aPointAspect);
aPresentation->SetPrimitivesAspect(anAreaAspect);
aPresentation->SetPrimitivesAspect(aLineAspect);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aCurGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aCurGroup->SetGroupPrimitivesAspect (anAreaAspect);
}
if (aCurGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
{
aCurGroup->SetGroupPrimitivesAspect (aLineAspect);
}
if (aCurGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
{
aCurGroup->SetGroupPrimitivesAspect (aPointAspect);
}
if (aCurGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
aCurGroup->SetGroupPrimitivesAspect(anAreaAspect);
if (aCurGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_LINE))
aCurGroup->SetGroupPrimitivesAspect(aLineAspect);
}
}
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (2);
LoadRecomputable(0);
LoadRecomputable(2);
}
//=======================================================================
//function : UnsetColor
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::UnsetColor()
{
if (!HasColor())
if ( !HasColor() )
{
myToRecomputeModes.Clear();
return;
}
hasOwnColor = Standard_False;
if (!HasWidth())
{
Handle(Prs3d_LineAspect) anEmptyAsp;
myDrawer->SetLineAspect (anEmptyAsp);
myDrawer->SetWireAspect (anEmptyAsp);
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
Handle(Prs3d_LineAspect) NullAsp;
Handle(Prs3d_ShadingAspect) NullShA;
if(!HasWidth()) {
myDrawer->SetLineAspect(NullAsp);
myDrawer->SetWireAspect(NullAsp);
myDrawer->SetFreeBoundaryAspect(NullAsp);
myDrawer->SetUnFreeBoundaryAspect(NullAsp);
myDrawer->SetSeenLineAspect(NullAsp);
}
else
{
Quantity_Color aColor;
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, aColor);
myDrawer->LineAspect()->SetColor (aColor);
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire, aColor);
myDrawer->WireAspect()->SetColor (aColor);
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free, aColor);
myDrawer->FreeBoundaryAspect()->SetColor (aColor);
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor);
myDrawer->UnFreeBoundaryAspect()->SetColor (aColor);
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor);
myDrawer->SeenLineAspect()->SetColor (aColor);
else {
Quantity_Color CC;
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->LineAspect()->SetColor(CC);
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Wire,CC);
myDrawer->WireAspect()->SetColor(CC);
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Free,CC);
myDrawer->FreeBoundaryAspect()->SetColor(CC);
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_UnFree,CC);
myDrawer->UnFreeBoundaryAspect()->SetColor(CC);
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen,CC);
myDrawer->SeenLineAspect()->SetColor(CC);
}
if (HasMaterial()
|| IsTransparent())
{
if( HasMaterial() || IsTransparent()) {
Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link());
if (HasMaterial())
{
Quantity_Color aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
mat.SetColor (aColor);
if( HasMaterial() ) {
Quantity_Color color = myDrawer->Link()->ShadingAspect()->Color(myCurrentFacingModel);
mat.SetColor(color);
}
if (IsTransparent())
{
Standard_Real aTransp = myDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
mat.SetTransparency (aTransp);
if( IsTransparent() ) {
Standard_Real trans = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
mat.SetTransparency(trans);
}
myDrawer->ShadingAspect()->SetMaterial (mat ,myCurrentFacingModel);
myDrawer->ShadingAspect()->SetMaterial(mat,myCurrentFacingModel);
}
else
{
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
else {
myDrawer->SetShadingAspect(NullShA);
}
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
if (!GetContext().IsNull())
{
if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, AIS_Shaded)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) aPresentation =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->Link()->LineAspect()->Aspect();
Quantity_Color aColor;
AIS_GraphicTool::GetInteriorColor (myDrawer->Link(), aColor);
anAreaAsp->SetInteriorColor (aColor);
aPrs->SetPrimitivesAspect (anAreaAsp);
aPrs->SetPrimitivesAspect (aLineAsp);
Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->Link()->LineAspect()->Aspect();
Quantity_Color CC;
AIS_GraphicTool::GetInteriorColor(myDrawer->Link(),CC);
anAreaAsp->SetInteriorColor(CC);
aPresentation->SetPrimitivesAspect(anAreaAsp);
aPresentation->SetPrimitivesAspect(aLineAsp);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
{
aGroup->SetGroupPrimitivesAspect (aLineAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
aGroup->SetGroupPrimitivesAspect(anAreaAsp);
if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_LINE))
aGroup->SetGroupPrimitivesAspect(aLineAsp);
}
}
LoadRecomputable (AIS_WireFrame);
LoadRecomputable (2);
}
//=======================================================================
//function : setWidth
//purpose :
//=======================================================================
void AIS_Shape::setWidth (const Handle(AIS_Drawer)& theDrawer,
const Standard_Real theLineWidth) const
{
if (!theDrawer->HasLineAspect())
{
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
}
if (!theDrawer->HasWireAspect())
{
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
*theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
}
// disable dedicated line aspects
theDrawer->SetFreeBoundaryAspect (theDrawer->LineAspect());
theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect());
theDrawer->SetSeenLineAspect (theDrawer->LineAspect());
// override width
theDrawer->LineAspect()->SetWidth (theLineWidth);
theDrawer->WireAspect()->SetWidth (theLineWidth);
LoadRecomputable(0);
LoadRecomputable(2);
}
//=======================================================================
@@ -700,48 +631,64 @@ void AIS_Shape::setWidth (const Handle(AIS_Drawer)& theDrawer,
//purpose :
//=======================================================================
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
void AIS_Shape::SetWidth(const Standard_Real W)
{
setWidth (myDrawer, theLineWidth);
myOwnWidth = theLineWidth;
LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
LoadRecomputable (2); // and the bounding box...
if(HasColor() || HasWidth()){
myDrawer->LineAspect()->SetWidth(W);
myDrawer->WireAspect()->SetWidth(W);
myDrawer->FreeBoundaryAspect()->SetWidth(W);
myDrawer->UnFreeBoundaryAspect()->SetWidth(W);
myDrawer->SeenLineAspect()->SetWidth(W);
}
else{
Quantity_Color CC;
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->SetLineAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Wire,CC);
myDrawer->SetWireAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Free,CC);
myDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_UnFree,CC);
myDrawer->SetUnFreeBoundaryAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen,CC);
myDrawer->SetSeenLineAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
}
myOwnWidth = W;
LoadRecomputable(0); // means that it is necessary to recompute only the wireframe....
LoadRecomputable(2); // and the bounding box...
}
//=======================================================================
//function : UnsetWidth
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::UnsetWidth()
{
if (myOwnWidth == 0.0)
if(myOwnWidth == 0.0)
{
myToRecomputeModes.Clear();
return;
}
myOwnWidth=0.0;
myOwnWidth = 0.0;
Handle(Prs3d_LineAspect) NullAsp;
Handle(Prs3d_LineAspect) anEmptyAsp;
if (!HasColor())
{
myDrawer->SetLineAspect (anEmptyAsp);
myDrawer->SetWireAspect (anEmptyAsp);
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
if(!HasColor()){
myDrawer->SetLineAspect(NullAsp);
myDrawer->SetWireAspect(NullAsp);
myDrawer->SetFreeBoundaryAspect(NullAsp);
myDrawer->SetUnFreeBoundaryAspect(NullAsp);
myDrawer->SetSeenLineAspect(NullAsp);
}
else
{
myDrawer->LineAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line));
myDrawer->WireAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Wire));
myDrawer->FreeBoundaryAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Free));
myDrawer->UnFreeBoundaryAspect()->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree));
myDrawer->SeenLineAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen));
else{
myDrawer->LineAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line));
myDrawer->WireAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Wire));
myDrawer->FreeBoundaryAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Free));
myDrawer->UnFreeBoundaryAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_UnFree));
myDrawer->SeenLineAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Seen));
}
LoadRecomputable (AIS_WireFrame);
LoadRecomputable(0);
}
//=======================================================================
@@ -756,188 +703,146 @@ void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
//=======================================================================
//function : SetMaterial
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
void AIS_Shape::SetMaterial(const Graphic3d_MaterialAspect& aMat)
{
if (!myDrawer->HasShadingAspect())
{
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
*myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
hasOwnMaterial = Standard_True;
myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
if (HasColor())
{
myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
}
myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
if (!GetContext().IsNull())
{
if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, AIS_Shaded)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) aPresentation =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
aPrs->SetPrimitivesAspect (anAreaAsp);
aPresentation->SetPrimitivesAspect(anAreaAsp);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
aGroup->SetGroupPrimitivesAspect(anAreaAsp);
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}
}
//=======================================================================
//function : UnsetMaterial
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::UnsetMaterial()
{
if (!HasMaterial())
{
return;
}
if( !HasMaterial() ) return;
if (HasColor()
|| IsTransparent())
{
myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel),
myCurrentFacingModel);
if (HasColor())
{
myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
if( HasColor() || IsTransparent()) {
Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(myDrawer->Link());
if( HasColor() ) {
Quantity_Color color = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
mat.SetColor(color);
}
}
else
{
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
if( IsTransparent() ) {
Standard_Real trans = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
mat.SetTransparency(trans);
}
myDrawer->ShadingAspect()->SetMaterial(mat,myCurrentFacingModel);
} else {
Handle(Prs3d_ShadingAspect) SA;
myDrawer->SetShadingAspect(SA);
}
hasOwnMaterial = Standard_False;
if (!GetContext().IsNull())
{
if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, AIS_Shaded)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) aPresentation =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
aPrs->SetPrimitivesAspect (anAreaAsp);
aPresentation->SetPrimitivesAspect(anAreaAsp);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
aGroup->SetGroupPrimitivesAspect(anAreaAsp);
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}
//=======================================================================
//function : setTransparency
//purpose :
//=======================================================================
void AIS_Shape::setTransparency (const Handle(AIS_Drawer)& theDrawer,
const Standard_Real theValue) const
{
if (!theDrawer->HasShadingAspect())
{
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
*theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
}
// override transparency
theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
}
//=======================================================================
//function : SetTransparency
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::SetTransparency (const Standard_Real theValue)
void AIS_Shape::SetTransparency(const Standard_Real AValue)
{
setTransparency (myDrawer, theValue);
myTransparency = theValue;
if ( !HasColor() && !HasMaterial() ) {
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
myDrawer->ShadingAspect()->SetTransparency(AValue,myCurrentFacingModel);
myTransparency = AValue;
if (!GetContext().IsNull())
{
if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, AIS_Shaded)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) aPresentation =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
aPrs->SetPrimitivesAspect (anAreaAsp);
// force highest priority for transparent objects
aPrs->SetDisplayPriority (10);
aPresentation->SetPrimitivesAspect(anAreaAsp);
//force highest priority for transparent objects
aPresentation->SetDisplayPriority(10);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
aGroup->SetGroupPrimitivesAspect(anAreaAsp);
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}
//=======================================================================
//function : UnsetTransparency
//purpose :
//purpose :
//=======================================================================
void AIS_Shape::UnsetTransparency()
{
myTransparency = 0.0;
if (!myDrawer->HasShadingAspect())
{
return;
}
else if (HasColor() || HasMaterial())
{
myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
}
else
{
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
if( HasColor() || HasMaterial() ) {
myDrawer->ShadingAspect()->SetTransparency(0.0,myCurrentFacingModel);
} else {
Handle(Prs3d_ShadingAspect) SA;
myDrawer->SetShadingAspect(SA);
}
if (!GetContext().IsNull())
{
if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
{
Handle(Prs3d_Presentation) aPrs = GetContext()->MainPrsMgr()->Presentation (this, AIS_Shaded)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
myTransparency = 0.0;
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) aPresentation =
GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
aPrs->SetPrimitivesAspect (anAreaAsp);
aPresentation->SetPrimitivesAspect(anAreaAsp);
// Check if aspect of given type is set for the group,
// because setting aspect for group with no already set aspect
// can lead to loss of presentation data
if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
{
aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
aPrs->ResetDisplayPriority();
if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
aGroup->SetGroupPrimitivesAspect(anAreaAsp);
aPresentation->ResetDisplayPriority();
}
}
myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}

View File

@@ -5,8 +5,6 @@ AIS_LocalContext_1.cxx
AIS_NListTransient.hxx
AIS_NListIteratorOfListTransient.hxx
AIS_NDataMapOfTransientIteratorOfListTransient.hxx
AIS_ColoredShape.hxx
AIS_ColoredShape.cxx
AIS_TexturedShape.hxx
AIS_TexturedShape.cxx
AIS_Triangulation.cdl

View File

@@ -338,60 +338,54 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ();
BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ();
//
Standard_Integer aNbTypeInt, aTypeInt, i, nI1, nI2;
Standard_Integer aNb[] = {
const Standard_Integer aNbTypeInt=10;
Standard_Integer aTypeInt, i, nI1, nI2;
Standard_Integer aNb[aNbTypeInt] = {
aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
aVFs.Extent(), aEFs.Extent(), aFFs.Extent(),
aVZs.Extent(), aEZs.Extent(), aFZs.Extent(),
aZZs.Extent()
};
//
aVZs.Extent(), aEZs.Extent(), aFZs.Extent(), aZZs.Extent()};
BOPDS_Interf* aInt=NULL;
//
aNbTypeInt=BOPDS_DS::NbInterfTypes();
for (aTypeInt = 0; aTypeInt < aNbTypeInt; ++aTypeInt) {
for (i = 0; i < aNb[aTypeInt]; ++i) {
switch(aTypeInt) {
case 0:
aInt=(BOPDS_Interf*)(&aVVs(i));
break;
case 1:
aInt=(BOPDS_Interf*)(&aVEs(i));
break;
case 2:
aInt=(BOPDS_Interf*)(&aEEs(i));
break;
case 3:
aInt=(BOPDS_Interf*)(&aVFs(i));
break;
case 4:
aInt=(BOPDS_Interf*)(&aEFs(i));
break;
case 5:
aInt=(BOPDS_Interf*)(&aFFs(i));
break;
case 6:
aInt=(BOPDS_Interf*)(&aVZs(i));
break;
case 7:
aInt=(BOPDS_Interf*)(&aEZs(i));
break;
case 8:
aInt=(BOPDS_Interf*)(&aFZs(i));
break;
case 9:
aInt=(BOPDS_Interf*)(&aZZs(i));
break;
default:
aInt=NULL;
}
switch(aTypeInt) {
case 0:
aInt=(BOPDS_Interf*)(&aVVs(i));
break;
case 1:
aInt=(BOPDS_Interf*)(&aVEs(i));
break;
case 2:
aInt=(BOPDS_Interf*)(&aEEs(i));
break;
case 3:
aInt=(BOPDS_Interf*)(&aVFs(i));
break;
case 4:
aInt=(BOPDS_Interf*)(&aEFs(i));
break;
case 5:
aInt=(BOPDS_Interf*)(&aFFs(i));
break;
case 6:
aInt=(BOPDS_Interf*)(&aVZs(i));
break;
case 7:
aInt=(BOPDS_Interf*)(&aEZs(i));
break;
case 8:
aInt=(BOPDS_Interf*)(&aFZs(i));
break;
case 9:
aInt=(BOPDS_Interf*)(&aZZs(i));
break;
default:
aInt=NULL;
}
//
aInt->Indices(nI1, nI2);
aInt->Indices(nI1, nI2);
if (nI1 == nI2) {
continue;
}
if (theDS->IsNewShape(nI1) || theDS->IsNewShape(nI2)) {
continue;
}
//
if (aTypeInt == 4) {

View File

@@ -166,6 +166,11 @@ is
FillImagesFaces1 (me:out)
is protected;
FillInternalVertices(me:out;
theLF:out ListOfShape from BOPCol;
theLIV:out ListOfInteger from BOPCol)
is protected;
--
-- solids
--

View File

@@ -16,30 +16,28 @@
// commercial license or contractual agreement.
#include <BOPAlgo_Builder.ixx>
//
#include <NCollection_IncAllocator.hxx>
//
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
//
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
//
#include <TopExp_Explorer.hxx>
//
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
#include <BOPInt_Context.hxx>
//
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_DS.hxx>
@@ -49,7 +47,7 @@
#include <BOPDS_Interf.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_VectorOfPoint.hxx>
//
#include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
@@ -59,7 +57,7 @@
#include <BOPTools_ListOfCoupleOfShape.hxx>
#include <BOPTools_MapOfSet.hxx>
#include <BOPTools_DataMapOfShapeSet.hxx>
#include <BOPAlgo_Builder_2Cnt.hxx>
static
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
@@ -73,190 +71,8 @@ static
void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
BOPCol_DataMapOfIntegerListOfShape& aMBlocks,
Handle(NCollection_IncAllocator)& aAllocator);
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
BOPAlgo_VectorOfVectorOfShape;
//
typedef NCollection_IndexedDataMap\
<BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
BOPAlgo_IndexedDataMapOfSetInteger;
//
//=======================================================================
//class : BOPAlgo_PairOfShapeBoolean
//purpose :
//=======================================================================
class BOPAlgo_PairOfShapeBoolean {
public:
BOPAlgo_PairOfShapeBoolean()
: myFlag(Standard_False) {
}
//
TopoDS_Shape& Shape1() {
return myShape1;
}
//
TopoDS_Shape& Shape2() {
return myShape2;
}
//
Standard_Boolean& Flag() {
return myFlag;
}
//
protected:
Standard_Boolean myFlag;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
};
//
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceFunctor {
protected:
BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
public:
//
BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
: myPVPSB(&aVPSB){
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const {
Standard_Boolean bFlag;
Standard_Integer i, iBeg, iEnd;
Handle(BOPInt_Context) aContext;
//
aContext=new BOPInt_Context;
//
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
if (bFlag) {
aPSB.Flag()=bFlag;
}
}
}
};
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static
void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
Standard_Integer aNbVPSB;
//
aNbVPSB=aVPSB.Extent();
BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
}
}
};
//=======================================================================
// BuilderFace
//
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_BuilderFace,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_BuilderFaceFunctor,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceCnt;
//
//=======================================================================
//class : BOPAlgo_VFI
//purpose :
//=======================================================================
class BOPAlgo_VFI {
public:
BOPAlgo_VFI()
: myFlag(-1) {
}
//
~BOPAlgo_VFI(){
}
//
void SetVertex(const TopoDS_Vertex& aV) {
myV=aV;
}
//
TopoDS_Vertex& Vertex() {
return myV;
}
//
void SetFace(const TopoDS_Face& aF) {
myF=aF;
}
//
TopoDS_Face& Face() {
return myF;
}
//
Standard_Integer Flag()const {
return myFlag;
}
//
void SetContext(const Handle(BOPInt_Context)& aContext) {
myContext=aContext;
}
//
const Handle(BOPInt_Context)& Context()const {
return myContext;
}
//
void Perform() {
Standard_Real aT1, aT2;
//
myFlag=myContext->ComputeVF(myV, myF, aT1, aT2);
}
//
protected:
Standard_Integer myFlag;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(BOPInt_Context) myContext;
};
//
typedef BOPCol_NCVector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VFI,
BOPAlgo_VectorOfVFI,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_VFIFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VFIFunctor,
BOPAlgo_VectorOfVFI,
Handle_BOPInt_Context> BOPAlgo_VFICnt;
//
//=======================================================================
//function : FillImagesFaces
//purpose :
@@ -677,15 +493,11 @@ void BOPAlgo_Builder::FillSameDomainFaces()
//=======================================================================
void BOPAlgo_Builder::FillImagesFaces1()
{
Standard_Integer i, aNbS, iSense, nVx, aNbVFI, iFlag;
Standard_Integer i, aNbS, iSense;
TopoDS_Face aFSD;
TopoDS_Vertex aVx;
BRep_Builder aBB;
BOPCol_ListOfInteger aLIAV;
BOPCol_ListOfShape aLFIm;
BOPCol_ListIteratorOfListOfInteger aItV;
BOPCol_ListIteratorOfListOfShape aItLS, aItF;
BOPAlgo_VectorOfVFI aVVFI;
BOPCol_ListIteratorOfListOfShape aItLS;
//
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
@@ -699,8 +511,7 @@ void BOPAlgo_Builder::FillImagesFaces1()
if (!mySplits.IsBound(aF)) {
continue;
}
//
// 1.
//
aLIAV.Clear();
myDS->AloneVertices(i, aLIAV);
aLFIm.Clear();
@@ -722,49 +533,46 @@ void BOPAlgo_Builder::FillImagesFaces1()
}
}
//
//FillInternalVertices(aLFIm, aLIAV);
FillInternalVertices(aLFIm, aLIAV);
//
myImages.Bind(aF, aLFIm);
//
// 2. fill myOrigins
//fill myOrigins
aItLS.Initialize(aLFIm);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value()));
myOrigins.Bind(aFSp, aF);
}
//
// 3.
aItV.Initialize(aLIAV);
for (; aItV.More(); aItV.Next()) {
nVx=aItV.Value();
aVx=(*(TopoDS_Vertex*)(&myDS->Shape(nVx)));
aVx.Orientation(TopAbs_INTERNAL);
//
aItF.Initialize(aLFIm);
for (; aItF.More(); aItF.Next()) {
TopoDS_Face& aFy=(*(TopoDS_Face*)(&aItF.Value()));
//
BOPAlgo_VFI& aVFI=aVVFI.Append1();
aVFI.SetVertex(aVx);
aVFI.SetFace(aFy);
}
}
}// for (i=0; i<aNbS; ++i) {
}
//=======================================================================
// function: FillInternalVertices
// purpose:
//=======================================================================
void BOPAlgo_Builder::FillInternalVertices(BOPCol_ListOfShape& aLFIm,
BOPCol_ListOfInteger& aLIAV)
{
Standard_Integer nV, iFlag;
Standard_Real aU1, aU2;
TopoDS_Vertex aV;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfInteger aItV;
BOPCol_ListIteratorOfListOfShape aItF;
//
// 4.
aNbVFI=aVVFI.Extent();
//================================================================
BOPAlgo_VFICnt::Perform(myRunParallel, aVVFI, myContext);
//================================================================
//
for (i=0; i < aNbVFI; ++i) {
BOPAlgo_VFI& aVFI=aVVFI(i);
aItV.Initialize(aLIAV);
for (; aItV.More(); aItV.Next()) {
nV=aItV.Value();
aV=(*(TopoDS_Vertex*)(&myDS->Shape(nV)));
aV.Orientation(TopAbs_INTERNAL);
//
iFlag=aVFI.Flag();
if (!iFlag) {
TopoDS_Vertex& aVx=aVFI.Vertex();
TopoDS_Face& aFy=aVFI.Face();
aBB.Add(aFy, aVx);
aItF.Initialize(aLFIm);
for (; aItF.More(); aItF.Next()) {
TopoDS_Face& aF=(*(TopoDS_Face*)(&aItF.Value()));
iFlag=myContext->ComputeVF(aV, aF, aU1, aU2);
if (!iFlag) {
aBB.Add(aF, aV);
break;
}
}
}
}
@@ -849,6 +657,7 @@ void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
aMEC.Clear();
aMVS.Clear();
}
//=======================================================================
//function : FillMap
//purpose :
@@ -913,7 +722,6 @@ Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
}
return bRet;
}
/*
//DEBf
{

View File

@@ -0,0 +1,252 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef BOPAlgo_Builder_2Cnt_HeaderFile
#define BOPAlgo_Builder_2Cnt_HeaderFile
#include <NCollection_IndexedDataMap.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPInt_Context.hxx>
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
//=======================================================================
//class : BOPAlgo_BuilderFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderFaceFunctor {
protected:
BOPAlgo_VectorOfBuilderFace* myPVBF;
//
public:
//
BOPAlgo_BuilderFaceFunctor(BOPAlgo_VectorOfBuilderFace& aVBF)
: myPVBF(&aVBF) {
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const{
Standard_Integer i, iBeg, iEnd;
//
BOPAlgo_VectorOfBuilderFace& aVBF=*myPVBF;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_BuilderFace& aBF=aVBF(i);
//
aBF.Perform();
}
}
};
//=======================================================================
//class : BOPAlgo_BuilderFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfBuilderFace& aVBF) {
//
BOPAlgo_BuilderFaceFunctor aBFF(aVBF);
Standard_Integer aNbBF=aVBF.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbBF), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbBF));
}
}
//
};
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
BOPAlgo_VectorOfVectorOfShape;
//
typedef NCollection_IndexedDataMap\
<BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
BOPAlgo_IndexedDataMapOfSetInteger;
//
//=======================================================================
//class : BOPAlgo_PairOfShapeBoolean
//purpose :
//=======================================================================
class BOPAlgo_PairOfShapeBoolean {
public:
BOPAlgo_PairOfShapeBoolean()
: myFlag(Standard_False) {
}
//
TopoDS_Shape& Shape1() {
return myShape1;
}
//
TopoDS_Shape& Shape2() {
return myShape2;
}
//
Standard_Boolean& Flag() {
return myFlag;
}
//
protected:
Standard_Boolean myFlag;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
};
//
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceFunctor {
protected:
BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
public:
//
BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
: myPVPSB(&aVPSB){
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const {
Standard_Boolean bFlag;
Standard_Integer i, iBeg, iEnd;
Handle(BOPInt_Context) aContext;
//
aContext=new BOPInt_Context;
//
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
if (bFlag) {
aPSB.Flag()=bFlag;
}
}
}
};
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static
void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
Standard_Integer aNbVPSB;
//
aNbVPSB=aVPSB.Extent();
BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
}
}
//
};
//
typedef BOPCol_NCVector<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
//
//=======================================================================
//class : BOPAlgo_BuilderSolidFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSolidFunctor {
protected:
BOPAlgo_VectorOfBuilderSolid* myPVBS;
//
public:
//
BOPAlgo_BuilderSolidFunctor(BOPAlgo_VectorOfBuilderSolid& aVBS)
: myPVBS(&aVBS) {
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const{
Standard_Integer i, iBeg, iEnd;
//
BOPAlgo_VectorOfBuilderSolid& aVBS=*myPVBS;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_BuilderSolid& aBS=aVBS(i);
//
aBS.Perform();
}
}
};
//=======================================================================
//class : BOPAlgo_BuilderSolidCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSolidCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfBuilderSolid& aVBS) {
Standard_Integer aNbBS=aVBS.Extent();
BOPAlgo_BuilderSolidFunctor aBSF(aVBS);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbBS), aBSF);
}
else {
aBSF.operator()(flexible_range<Standard_Integer>(0,aNbBS));
}
}
//
};
#endif

View File

@@ -16,13 +16,13 @@
// commercial license or contractual agreement.
#include <BOPAlgo_Builder.hxx>
//
#include <NCollection_IncAllocator.hxx>
#include <NCollection_UBTreeFiller.hxx>
//
#include <Bnd_Box.hxx>
#include <TopAbs_State.hxx>
//
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Solid.hxx>
@@ -33,10 +33,10 @@
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx>
//
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
//
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
@@ -49,8 +49,6 @@
#include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
#include <BOPInt_Context.hxx>
//
@@ -63,6 +61,7 @@
#include <BOPTools_Set.hxx>
//
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_Builder_2Cnt.hxx>
static
@@ -74,20 +73,6 @@ static
BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS);
//=======================================================================
// BOPAlgo_BuilderSolid
//
typedef BOPCol_NCVector
<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_BuilderSolid,
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_BuilderSolidFunctor,
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidCnt;
//
//=======================================================================
//class : BOPAlgo_ShapeBox
//purpose : Auxiliary class
@@ -171,10 +156,9 @@ void BOPAlgo_Builder::FillImagesSolids()
//function : FillIn3DParts
//purpose :
//=======================================================================
void BOPAlgo_Builder::FillIn3DParts
(BOPCol_DataMapOfShapeListOfShape& theInParts,
BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& )
void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts,
BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& )
{
Standard_Boolean bHasImage;
Standard_Integer i, k, aNbS, aNbLIF, nFP, aNbFP, aNbFIN, iIsIN;
@@ -208,16 +192,16 @@ void BOPAlgo_Builder::FillIn3DParts
const BOPCol_ListOfShape& aLS=myImages.Find(aS);
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSx=aItLS.Value();
//
Bnd_Box aBox;
BRepBndLib::Add(aSx, aBox);
//
aSB.SetShape(aSx);
aSB.SetBox(aBox);
//
aDMISB.Bind(k, aSB);
++k;
const TopoDS_Shape& aSx=aItLS.Value();
//
Bnd_Box aBox;
BRepBndLib::Add(aSx, aBox);
//
aSB.SetShape(aSx);
aSB.SetBox(aBox);
//
aDMISB.Bind(k, aSB);
++k;
}
}
else {
@@ -277,7 +261,7 @@ void BOPAlgo_Builder::FillIn3DParts
const TopoDS_Shape& aShell=aIt.Value();
bHasImage=myImages.IsBound(aShell);
if (bHasImage){
break;
break;
}
}
//
@@ -324,10 +308,10 @@ void BOPAlgo_Builder::FillIn3DParts
const BOPAlgo_ShapeBox& aSBF=aDMISB.Find(nFP);
const TopoDS_Face& aFP=(*(TopoDS_Face*)&aSBF.Shape());
if (aMF.Contains(aFP)) {
continue;
continue;
}
if (aMFDone.Contains(aFP)) {
continue;
continue;
}
//
aMFDone.Add(aFP);
@@ -339,19 +323,19 @@ void BOPAlgo_Builder::FillIn3DParts
//
aItLI1.Initialize(aLIFP);
for (; aItLI1.More(); aItLI1.Next()) {
const TopoDS_Shape& aFx=aDMISB.Find(aItLI1.Value()).Shape();
if (!aMFDone.Contains(aFx)) {
aLFP.Append(aFx);
}
const TopoDS_Shape& aFx=aDMISB.Find(aItLI1.Value()).Shape();
if (!aMFDone.Contains(aFx)) {
aLFP.Append(aFx);
}
}
//
aLCBF.Clear();
//----------------------------------------
{
Handle(NCollection_IncAllocator) aAlr2;
aAlr2=new NCollection_IncAllocator();
//
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aME, aLCBF, aAlr2);
Handle(NCollection_IncAllocator) aAlr2;
aAlr2=new NCollection_IncAllocator();
//
BOPTools_AlgoTools::MakeConnexityBlock(aLFP, aME, aLCBF, aAlr2);
}
//----------------------------------------
aItLS.Initialize(aLCBF);
@@ -369,8 +353,8 @@ void BOPAlgo_Builder::FillIn3DParts
if (aNbFIN || aNbLIF) {
aItLS.Initialize(aLIF);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aFI=aItLS.Value();
aLFIN.Append(aFI);
const TopoDS_Shape& aFI=aItLS.Value();
aLFIN.Append(aFI);
}
theInParts.Bind(aSolid, aLFIN);
}
@@ -381,13 +365,14 @@ void BOPAlgo_Builder::FillIn3DParts
//---------------------------------------------
}// for (i=0; i<aNbS; ++i) {
}
//=======================================================================
//function : BuildDraftSolid
//purpose :
//=======================================================================
void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
TopoDS_Shape& theDraftSolid,
BOPCol_ListOfShape& theLIF)
TopoDS_Shape& theDraftSolid,
BOPCol_ListOfShape& theLIF)
{
myErrorStatus=0;
//
@@ -398,7 +383,7 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
TopoDS_Shell aShD;
TopoDS_Shape aFSDx, aFx;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItS;
BOPCol_ListIteratorOfListOfShape aItS;
//
aOrSd=theSolid.Orientation();
theDraftSolid.Orientation(aOrSd);
@@ -434,9 +419,7 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
theLIF.Append(aFSDx);
}
else {
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aFSDx,
aF,
myContext);
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aFSDx, aF, myContext);
if (bToReverse) {
aFSDx.Reverse();
}
@@ -478,10 +461,9 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
//function : BuildSplitSolids
//purpose :
//=======================================================================
void BOPAlgo_Builder::BuildSplitSolids
(BOPCol_DataMapOfShapeListOfShape& theInParts,
BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& )
void BOPAlgo_Builder::BuildSplitSolids(BOPCol_DataMapOfShapeListOfShape& theInParts,
BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& )
{
myErrorStatus=0;
//
@@ -668,9 +650,7 @@ void BOPAlgo_Builder::FillInternalShapes()
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
aType=aS.ShapeType();
if (aType==TopAbs_VERTEX ||
aType==TopAbs_EDGE ||
aType==TopAbs_WIRE) {
if (aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||aType==TopAbs_WIRE) {
if (aMFence.Add(aS)) {
if (myImages.IsBound(aS)) {
const BOPCol_ListOfShape &aLSp=myImages.Find(aS);
@@ -829,8 +809,8 @@ void BOPAlgo_Builder::FillInternalShapes()
//function : OwnInternalShapes
//purpose :
//=======================================================================
void OwnInternalShapes(const TopoDS_Shape& theS,
BOPCol_IndexedMapOfShape& theMx)
void OwnInternalShapes(const TopoDS_Shape& theS,
BOPCol_IndexedMapOfShape& theMx)
{
TopoDS_Iterator aIt;
//

View File

@@ -125,6 +125,7 @@ void BOPAlgo_CheckerSI::Init()
//=======================================================================
void BOPAlgo_CheckerSI::Perform()
{
try {
OCC_CATCH_SIGNALS
//
@@ -142,46 +143,42 @@ void BOPAlgo_CheckerSI::Perform()
}
//
BOPAlgo_PaveFiller::Perform();
//
if (!myErrorStatus) {
PerformVZ();
if (myErrorStatus) {
return;
}
//
if (!myErrorStatus) {
PerformEZ();
PerformVZ();
if (myErrorStatus) {
return;
}
//
PerformEZ();
if (myErrorStatus) {
return;
}
//
if (!myErrorStatus) {
PerformFZ();
PerformFZ();
if (myErrorStatus) {
return;
}
//
if (!myErrorStatus) {
PerformZZ();
}
//
if (!myErrorStatus) {
PostTreat();
PerformZZ();
if (myErrorStatus) {
return;
}
//
if (myNonDestructive) {
Standard_Integer iErr;
//
iErr=myErrorStatus;
//
PostTreatCopy();
if (!myErrorStatus) {
myErrorStatus=iErr;
}
PostTreat();
if (myErrorStatus) {
return;
}
}
//
catch (Standard_Failure) {
//
if (myNonDestructive) {
PostTreatCopy();
}
//
myErrorStatus=11;
}
catch (Standard_Failure) {
myErrorStatus=11;
}
}
//=======================================================================
@@ -205,9 +202,6 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVV& aVV=aVVs(i);
aVV.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@@ -218,9 +212,6 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVE& aVE=aVEs(i);
aVE.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@@ -231,9 +222,6 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfEE& aEE=aEEs(i);
aEE.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@@ -244,9 +232,6 @@ void BOPAlgo_CheckerSI::PostTreat()
for (i=0; i!=aNb; ++i) {
const BOPDS_InterfVF& aVF=aVFs(i);
aVF.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@@ -260,9 +245,6 @@ void BOPAlgo_CheckerSI::PostTreat()
continue;
}
aEF.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}
@@ -322,9 +304,6 @@ void BOPAlgo_CheckerSI::PostTreat()
//
const BOPDS_InterfVZ& aVZ=aVZs(i);
aVZ.Indices(n1, n2);
if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
continue;
}
aPK.SetIds(n1, n2);
aMPK.Add(aPK);
}

View File

@@ -16,133 +16,37 @@
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.ixx>
//
#include <NCollection_IncAllocator.hxx>
//
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepBndLib.hxx>
//
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
#include <BOPInt_Context.hxx>
//
#include <BOPDS_Iterator.hxx>
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_SubIterator.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_FaceInfo.hxx>
#include <BOPCol_MapOfInteger.hxx>
//=======================================================================
//class : BOPAlgo_VertexFace
//purpose :
//=======================================================================
class BOPAlgo_VertexFace {
public:
BOPAlgo_VertexFace()
: myIV(-1), myIF(-1), myIVx(-1),
myFlag(-1), myT1(-1.), myT2(-1.) {
}
//
~BOPAlgo_VertexFace(){
}
//
void SetIndices(const Standard_Integer nV,
const Standard_Integer nF,
const Standard_Integer nVx) {
myIV=nV;
myIF=nF;
myIVx=nVx;
}
//
void Indices(Standard_Integer& nV,
Standard_Integer& nF,
Standard_Integer& nVx) const {
nV=myIV;
nF=myIF;
nVx=myIVx;
}
//
void SetVertex(const TopoDS_Vertex& aV) {
myV=aV;
}
//
const TopoDS_Vertex& Vertex()const {
return myV;
}
//
void SetFace(const TopoDS_Face& aF) {
myF=aF;
}
//
const TopoDS_Face& Face()const {
return myF;
}
//
Standard_Integer Flag()const {
return myFlag;
}
//
void Parameters(Standard_Real& aT1,
Standard_Real& aT2)const {
aT1=myT1;
aT2=myT2;
}
//
void SetContext(const Handle(BOPInt_Context)& aContext) {
myContext=aContext;
}
//
const Handle(BOPInt_Context)& Context()const {
return myContext;
}
//
void Perform() {
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
}
//
protected:
Standard_Integer myIV;
Standard_Integer myIF;
Standard_Integer myIVx;
Standard_Integer myFlag;
Standard_Real myT1;
Standard_Real myT2;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(BOPInt_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_VertexFace>
BOPAlgo_VectorOfVertexFace;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VertexFace,
BOPAlgo_VectorOfVertexFace,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_VertexFaceFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VertexFaceFunctor,
BOPAlgo_VectorOfVertexFace,
Handle_BOPInt_Context> BOPAlgo_VertexFaceCnt;
//
//=======================================================================
// function: PerformVF
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PerformVF()
void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i, aNbVF, k;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i;
Standard_Real aT1, aT2, aTolF, aTolV;
BRep_Builder aBB;
BOPAlgo_VectorOfVertexFace aVVF;
//
myErrorStatus=0;
//
@@ -179,56 +83,34 @@ void BOPAlgo_PaveFiller::PerformVF()
continue;
}
//
myDS->ChangeFaceInfo(nF);// !
//
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
//
aVertexFace.SetIndices(nV, nF, nVx);
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Extent();
//================================================================
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
//================================================================
//
for (k=0; k < aNbVF; ++k) {
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
continue;
}
//
aVertexFace.Indices(nV, nF, nVx);
aVertexFace.Parameters(aT1, aT2);
const TopoDS_Vertex& aV=aVertexFace.Vertex();
const TopoDS_Face& aF=aVertexFace.Face();
// 1
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nVx, nF);
// 3
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
// 4
aTolV = BRep_Tool::Tolerance(aV);
aTolF = BRep_Tool::Tolerance(aF);
if (aTolV < aTolF) {
aBB.UpdateVertex(aV, aTolF);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
//
iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
if (!iFlag) {
// 1
i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i);
aVF.SetIndices(nVx, nF);
aVF.SetUV(aT1, aT2);
// 2
myDS->AddInterf(nVx, nF);
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
//
if (aTolV < aTolF) {
aBB.UpdateVertex(aV, aTolF);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV);
}
}
}//for (k=0; k < aNbVF; ++k) {
}// for (; myIterator->More(); myIterator->Next()) {
}// if (iSize) {
else {
iSize=10;
@@ -239,18 +121,21 @@ void BOPAlgo_PaveFiller::PerformVF()
}
//
TreatVerticesEE();
}
}
//=======================================================================
//function : TreatVerticesEE
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::TreatVerticesEE()
void BOPAlgo_PaveFiller::TreatVerticesEE()
{
Standard_Integer i, aNbS, aNbEEs, nF, nV, iFlag;
Standard_Real aT1, aT2;
BOPCol_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_IncAllocator) aAllocator;
//
//-----------------------------------------------------scope_1 f
aAllocator=new NCollection_IncAllocator();
BOPCol_ListOfInteger aLIV(aAllocator), aLIF(aAllocator);
BOPCol_MapOfInteger aMI(100, aAllocator);
@@ -324,4 +209,5 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
}
//
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
}

View File

@@ -13,5 +13,7 @@ BOPAlgo_Builder_4.cxx
BOPAlgo_BOP_1.cxx
BOPAlgo_WireSplitter_1.cxx
BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_Builder_2Cnt.hxx
BOPAlgo_CheckerSI_1.cxx
BOPAlgo_PaveFiller_9.cxx

View File

@@ -28,13 +28,6 @@
#include <Draw.hxx>
#include <DrawTrSurf.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
@@ -42,13 +35,12 @@
#include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_VectorOfInterfEF.hxx>
#include <BOPDS_VectorOfInterfFF.hxx>
#include <BOPDS_VectorOfInterfVZ.hxx>
#include <BOPDS_VectorOfInterfEZ.hxx>
#include <BOPDS_VectorOfInterfFZ.hxx>
#include <BOPDS_VectorOfInterfZZ.hxx>
#include <BOPDS_DS.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPAlgo_ArgumentAnalyzer.hxx>
#include <BOPAlgo_CheckResult.hxx>
#include <BRepBuilderAPI_Copy.hxx>
static
Standard_Integer bopcheck (Draw_Interpretor&, Standard_Integer, const char** );
@@ -87,61 +79,46 @@ Standard_Integer bopcheck
(Draw_Interpretor& di, Standard_Integer n, const char** a )
{
if (n<2) {
di << " Use >bopcheck Shape [level of check: 0 - 9" << "\n";
di << " Use >bopcheck Shape [level of check: 0 - 5" << "\n";
di << " The level of check defines ";
di << " which interferences will be checked:\n";
di << " 0 - V/V only\n";
di << " 1 - V/V, V/E\n";
di << " 2 - V/V, V/E, E/E\n";
di << " 3 - V/V, V/E, E/E , V/F\n";
di << " 4 - V/V, V/E, E/E, V/F , E/F\n";
di << " 5 - V/V, V/E, E/E, V/F, E/F, F/F;\n";
di << " 6 - V/V, V/E, E/E, V/F, E/F, F/F, V/Z\n";
di << " 7 - V/V, V/E, E/E, V/F, E/F, F/F, E/Z\n";
di << " 8 - V/V, V/E, E/E, V/F, E/F, F/F, E/Z, F/Z\n";
di << " 9 - V/V, V/E, E/E, V/F, E/F, F/F, E/Z, F/Z, Z/Z\n";
di << " Default level is 9\n";
di << " which interferferences will be checked:\n";
di << " 0 - only V/V;\n";
di << " 1 - V/V and V/E;\n";
di << " 2 - V/V, V/E and E/E;\n";
di << " 3 - V/V, V/E, E/E and V/F;\n";
di << " 4 - V/V, V/E, E/E, V/F and E/F;\n";
di << " 5 - all interferences, default value.\n";
return 1;
}
//
TopoDS_Shape aS = DBRep::Get(a[1]);
if (aS.IsNull()) {
TopoDS_Shape aS1 = DBRep::Get(a[1]);
if (aS1.IsNull()) {
di << "null shapes are not allowed here!";
return 1;
}
TopoDS_Shape aS = aS1;
//
Standard_Integer theLevelOfCheck, aNbInterfTypes;
//
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
//
theLevelOfCheck = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
if (theLevelOfCheck > aNbInterfTypes-1) {
di << "Invalid level";
return 1;
}
//-------------------------------------------------------------------
char buf[256];
char type[10][4] = {
"V/V", "V/E", "E/E","V/F", "E/F", "F/F", "V/Z", "E/Z", "F/Z", "Z/Z"
};
Standard_Integer iErr, aTypeInt, i, ind, j, nI1, nI2;
Standard_Integer iErr, aTypeInt, i, ind, j;
Standard_Integer nI1, nI2, theLevelOfCheck;
Standard_Boolean bSelfInt, bFFInt;
//
if (theLevelOfCheck >= 0 && theLevelOfCheck < aNbInterfTypes) {
char buf[256];
char type[6][4] = {"V/V", "V/E", "E/E","V/F", "E/F", "F/F"};
theLevelOfCheck = (n==3) ? Draw::Atoi(a[2]) : 5;
if (theLevelOfCheck >= 0 && theLevelOfCheck < 5) {
di << "Info:\nThe level of check is set to "
<< type[theLevelOfCheck] << ", i.e. intersection(s)\n";
for (i=theLevelOfCheck+1; i<aNbInterfTypes; ++i) {
for (i=theLevelOfCheck+1; i<=5; ++i) {
di << type[i];
if (i<aNbInterfTypes-1) {
if (i<5) {
di << ", ";
}
}
di << " will not be checked.\n\n";
}
//
BOPAlgo_CheckerSI aChecker;
BOPCol_ListOfShape anArgs;
//
anArgs.Append(aS);
aChecker.SetArguments(anArgs);
aChecker.SetLevelOfCheck(theLevelOfCheck);
@@ -156,59 +133,23 @@ Standard_Integer bopcheck
BOPDS_VectorOfInterfVF& aVFs=theDS->InterfVF();
BOPDS_VectorOfInterfEF& aEFs=theDS->InterfEF();
BOPDS_VectorOfInterfFF& aFFs=theDS->InterfFF();
BOPDS_VectorOfInterfVZ& aVZs=theDS->InterfVZ();
BOPDS_VectorOfInterfEZ& aEZs=theDS->InterfEZ();
BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ();
BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ();
//
Standard_Integer aNb[] ={
Standard_Integer aNb[6] ={
aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
aVFs.Extent(), aEFs.Extent(), aFFs.Extent(),
aVZs.Extent(), aEZs.Extent(), aFZs.Extent(),
aZZs.Extent(),
aVFs.Extent(), aEFs.Extent(), aFFs.Extent()
};
//
bSelfInt = Standard_False;
ind = 0;
for (aTypeInt = 0; aTypeInt < aNbInterfTypes; ++aTypeInt) {
for (aTypeInt = 0; aTypeInt < 6; ++aTypeInt) {
for (i = 0; i < aNb[aTypeInt]; ++i) {
BOPDS_Interf* aInt=NULL;
//
switch(aTypeInt) {
case 0:
aInt=(BOPDS_Interf*)(&aVVs(i));
break;
case 1:
aInt=(BOPDS_Interf*)(&aVEs(i));
break;
case 2:
aInt=(BOPDS_Interf*)(&aEEs(i));
break;
case 3:
aInt=(BOPDS_Interf*)(&aVFs(i));
break;
case 4:
aInt=(BOPDS_Interf*)(&aEFs(i));
break;
case 5:
aInt=(BOPDS_Interf*)(&aFFs(i));
break;
case 6:
aInt=(BOPDS_Interf*)(&aVZs(i));
break;
case 7:
aInt=(BOPDS_Interf*)(&aEZs(i));
break;
case 8:
aInt=(BOPDS_Interf*)(&aFZs(i));
break;
case 9:
aInt=(BOPDS_Interf*)(&aZZs(i));
break;
default:
break;
}
BOPDS_Interf* aInt =
(aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) :
((aTypeInt==1) ? (BOPDS_Interf*)(&aVEs(i)) :
((aTypeInt==2) ? (BOPDS_Interf*)(&aEEs(i)) :
((aTypeInt==3) ? (BOPDS_Interf*)(&aVFs(i)) :
((aTypeInt==4) ? (BOPDS_Interf*)(&aEFs(i)) :
(BOPDS_Interf*)(&aFFs(i))))));
//
nI1 = aInt->Index1();
nI2 = aInt->Index2();
@@ -216,10 +157,6 @@ Standard_Integer bopcheck
continue;
}
//
if(theDS->IsNewShape(nI1) || theDS->IsNewShape(nI2)) {
continue;
}
//
if (aTypeInt == 4) {
BOPDS_InterfEF& aEF=aEFs(i);
if (aEF.CommonPart().Type()==TopAbs_SHAPE) {

View File

@@ -232,11 +232,13 @@ is
UpdateEdge(me; E : Edge from TopoDS;
C1,C2 : Curve from Geom2d;
F : Face from TopoDS;
Tol : Real);
Tol : Real;
theContinuity : Shape from GeomAbs = GeomAbs_C0);
---C++: inline
---Purpose: Sets pcurves for the edge on the closed face. If
-- <C1> or <C2> is a null handle, remove any existing
---Purpose: Sets pcurves (with theContinuity) for the edge on
-- the closed face.
-- If <C1> or <C2> is a null handle, remove any existing
-- pcurve.
UpdateEdge(me; E : Edge from TopoDS;
@@ -248,7 +250,20 @@ is
---Purpose: Sets a pcurve for the edge on the face.
-- If <C> is a null handle, remove any existing pcurve.
UpdateEdge(me; E : Edge from TopoDS;
UpdateEdge(me; E : Edge from TopoDS;
C : Curve from Geom2d;
newSurf : Surface from Geom;
newL : Location from TopLoc;
theFace : Face from TopoDS;
Tol : Real from Standard);
---Purpose: Sets a pcurve for the edge on the face.
-- If <C> is a null handle, remove any existing pcurve.
-- New edge will be in the face <theFace>, which
-- based on surface newSurf. Old surface must be
-- deleted from <theFace> later.
UpdateEdge(me; E : Edge from TopoDS;
C : Curve from Geom2d;
S : Surface from Geom;
L : Location from TopLoc;
@@ -263,12 +278,28 @@ is
C1,C2 : Curve from Geom2d;
S : Surface from Geom;
L : Location from TopLoc;
Tol : Real);
Tol : Real from Standard;
theContinuity : Shape from GeomAbs = GeomAbs_C0);
---Purpose: Sets pcurves for the edge on the closed surface.
-- <C1> or <C2> is a null handle, remove any existing
---Purpose: Sets pcurves (with theContinuity) for the edge on the
-- closed surface.
-- If <C1> or <C2> is a null handle, remove any existing
-- pcurve.
UpdateEdge(me; E : Edge from TopoDS;
C1,C2 : Curve from Geom2d;
newSurf : Surface from Geom;
newL : Location from TopLoc;
theFace : Face from TopoDS;
Tol : Real from Standard);
---Purpose: Sets pcurves for the edge on the closed surface.
-- If <C1> or <C2> is a null handle, remove any
-- existing pcurve.
-- New edge will be in the face <theFace>, which
-- based on surface newSurf. Old surface must be
-- deleted from <theFace> later.
UpdateEdge(me; E : Edge from TopoDS;
C1,C2 : Curve from Geom2d;
S : Surface from Geom;

View File

@@ -228,7 +228,8 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
const Handle(Geom2d_Curve)& C1,
const Handle(Geom2d_Curve)& C2,
const Handle(Geom_Surface)& S,
const TopLoc_Location& L)
const TopLoc_Location& L,
const GeomAbs_Shape theContinuity = GeomAbs_C0)
{
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr;
@@ -254,7 +255,7 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
if ( !C1.IsNull() && !C2.IsNull() ) {
Handle(BRep_CurveOnClosedSurface) COS =
new BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0);
new BRep_CurveOnClosedSurface(C1,C2,S,L,theContinuity);
// test if there is already a range
if (!GC.IsNull()) {
COS->SetRange(f,l);
@@ -275,7 +276,8 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
const Handle(Geom_Surface)& S,
const TopLoc_Location& L,
const gp_Pnt2d& Pf,
const gp_Pnt2d& Pl)
const gp_Pnt2d& Pl,
const GeomAbs_Shape theContinuity = GeomAbs_C0)
{
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr;
@@ -301,7 +303,7 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
if ( !C1.IsNull() && !C2.IsNull() ) {
Handle(BRep_CurveOnClosedSurface) COS =
new BRep_CurveOnClosedSurface(C1,C2,S,L,GeomAbs_C0);
new BRep_CurveOnClosedSurface(C1,C2,S,L,theContinuity);
// test if there is already a range
if (!GC.IsNull()) {
COS->SetRange(f,l);
@@ -338,6 +340,167 @@ static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
}
}
//=======================================================================
//function : UpdateCurves
//purpose : Insert two pcurves <C1,C2> on surface <newSurf> with
// location <newL> in the list of curve representations <lcr>.
// Deletes curves, which belong to <oldSurf> because <oldSurf>
// will not be used later (presumably).
// Remove the pcurves on <S> from <lcr> if <C1> or <C2> is null
//=======================================================================
static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
const Handle(Geom2d_Curve)& C1,
const Handle(Geom2d_Curve)& C2,
const Handle(Geom_Surface)& newSurf,
const TopLoc_Location& newL,
const Handle(Geom_Surface)& oldSurf,
const TopLoc_Location oldL,
const GeomAbs_Shape theContinuity = GeomAbs_C0)
{
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_GCurve) GC;
Standard_Real aFirst = 0.0, aLast = 0.0;
Standard_Boolean rangeFound = Standard_False;
Standard_Boolean isModified = Standard_False;
while (itcr.More())
{
Handle(BRep_CurveRepresentation) cr = itcr.Value();
GC = Handle(BRep_GCurve)::DownCast(cr);
if ( !GC.IsNull() )
{
GC->Range(aFirst, aLast);
Standard_Boolean undefined = (Precision::IsPositiveInfinite(aLast) ||
Precision::IsNegativeInfinite(aFirst));
if (!undefined)
{
rangeFound = Standard_True;
}
Standard_Boolean cond = Standard_False;
cond = cond || GC->IsCurveOnSurface(oldSurf, oldL);
if(!cond)
{
if(GC->IsCurveOnClosedSurface())
{
Handle(BRep_CurveOnSurface) aCS = Handle(BRep_CurveOnSurface)::DownCast(GC);
cond = aCS->IsCurveOnSurface(oldSurf, oldL);
}
}
if (cond)
{
lcr.Remove(itcr);
isModified = Standard_True;
}
else
{
itcr.Next();
}
}//if ( !GC.IsNull() )
else
{
if (cr->IsPolygonOnSurface(oldSurf, oldL))
{
lcr.Remove(itcr);
isModified = Standard_True;
}
else
{
itcr.Next();
}
}
}
if ( !C1.IsNull() && !C2.IsNull() ) {
Handle(BRep_CurveOnClosedSurface) COS =
new BRep_CurveOnClosedSurface(C1,C2,newSurf,newL,theContinuity);
// test if there is already a range
if (rangeFound) {
COS->SetRange(aFirst,aLast);
}
lcr.Append(COS);
}
}
//=======================================================================
//function : UpdateCurves
//purpose : Insert the pcurve <C> on surface <newSurf> with
// location <newL> in the list of curve representations <lcr>.
// Remove the pcurves on <oldSurf> from <lcr> if <C> is null
//=======================================================================
static void UpdateCurves(BRep_ListOfCurveRepresentation& lcr,
const Handle(Geom2d_Curve)& C,
const Handle(Geom_Surface)& newSurf,
const TopLoc_Location& newL,
const Handle(Geom_Surface)& oldSurf,
const TopLoc_Location oldL)
{
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_CurveRepresentation) cr;
Handle(BRep_GCurve) GC;
Standard_Real f = 0.0, l = 0.0;
Standard_Boolean rangeFound = Standard_False;
// search the range of the 3d curve
// and remove any existing representation
while (itcr.More()) {
GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if (!GC.IsNull()) {
if (GC->IsCurve3D()) {
GC->Range(f, l);
Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
Precision::IsNegativeInfinite(f));
if (!undefined) {
rangeFound = Standard_True;
}
}
if (GC->IsCurveOnSurface(oldSurf,oldL))
{
GC->Range(f, l);
Standard_Boolean undefined = (Precision::IsPositiveInfinite(l) ||
Precision::IsNegativeInfinite(f));
if (!undefined)
{
rangeFound = Standard_True;
}
// remove existing curve on surface
// cr is used to keep a reference on the curve representation
// this avoid deleting it as its content may be referenced by C or S
cr = itcr.Value();
lcr.Remove(itcr);
}
else {
itcr.Next();
}
}
else {
itcr.Next();
}
}
if (! C.IsNull()) {
Handle(BRep_CurveOnSurface) COS = new BRep_CurveOnSurface(C,newSurf,newL);
// test if there is already a range
if (rangeFound) {
COS->SetRange(f,l);
}
lcr.Append(COS);
}
}
static void UpdatePoints(BRep_ListOfPointRepresentation& lpr,
Standard_Real p,
const Handle(Geom_Curve)& C,
@@ -573,6 +736,33 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
TE->Modified(Standard_True);
}
//=======================================================================
//function : UpdateEdge
//purpose :
//=======================================================================
void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const Handle(Geom2d_Curve)& C,
const Handle(Geom_Surface)& newSurf,
const TopLoc_Location& newL,
const TopoDS_Face& theFace,
const Standard_Real Tol) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
const TopLoc_Location l = newL.Predivided(E.Location());
const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &theFace.TShape());
const TopLoc_Location &L = theFace.Location() * TF->Location();
const Handle(Geom_Surface) &S = TF->Surface();
//BRep_Tool::Degenerated(E);
UpdateCurves(TE->ChangeCurves(),
C, newSurf, l, S,
L.Predivided(E.Location()));
TE->UpdateTolerance(Tol);
TE->Modified(Standard_True);
}
//=======================================================================
//function : UpdateEdge
@@ -607,12 +797,13 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const Handle(Geom2d_Curve)& C2,
const Handle(Geom_Surface)& S,
const TopLoc_Location& L,
const Standard_Real Tol) const
const Standard_Real Tol,
const GeomAbs_Shape theContinuity) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C1,C2,S,l);
UpdateCurves(TE->ChangeCurves(),C1,C2,S,l,theContinuity);
if (!C1.IsNull() && !C2.IsNull())
TE->Closed(C1->IsClosed() && C2->IsClosed());
@@ -894,6 +1085,36 @@ void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
TE->Modified(Standard_True);
}
//=======================================================================
//function : UpdateEdge
//purpose :
//=======================================================================
void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const Handle(Geom2d_Curve)& C1,
const Handle(Geom2d_Curve)& C2,
const Handle(Geom_Surface)& newSurf,
const TopLoc_Location& newL,
const TopoDS_Face& theFace,
const Standard_Real Tol) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
const TopLoc_Location l = newL.Predivided(E.Location());
const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &theFace.TShape());
const TopLoc_Location &L = theFace.Location() * TF->Location();
const Handle(Geom_Surface) &S = TF->Surface();
UpdateCurves(TE->ChangeCurves(),
C1,C2,newSurf,l,S,
L.Predivided(E.Location()));
if (!C1.IsNull() && !C2.IsNull())
TE->Closed(C1->IsClosed() && C2->IsClosed());
TE->UpdateTolerance(Tol);
TE->Modified(Standard_True);
}
//=======================================================================
//function : Continuity

View File

@@ -140,10 +140,11 @@ inline void BRep_Builder::UpdateEdge(const TopoDS_Edge& E,
const Handle(Geom2d_Curve)& C1,
const Handle(Geom2d_Curve)& C2,
const TopoDS_Face& F,
const Standard_Real Tol) const
const Standard_Real Tol,
const GeomAbs_Shape theContinuity) const
{
TopLoc_Location l;
UpdateEdge(E,C1,C2,BRep_Tool::Surface(F,l),l,Tol);
UpdateEdge(E,C1,C2,BRep_Tool::Surface(F,l),l,Tol, theContinuity);
}

View File

@@ -69,6 +69,7 @@ is
FreeEdge,
InvalidMultiConnexity,
InvalidRange,
PCurveIsOutOfDomainFace,
-- for wires
@@ -78,6 +79,7 @@ is
-- for faces
NoSurface,
OutOfSurfaceBoundary,
InvalidWire,
RedundantWire,
IntersectingWires,

View File

@@ -175,7 +175,15 @@ void BRepCheck::Print(const BRepCheck_Status stat,
case BRepCheck_CheckFail:
OS << "BRepCheck_CheckFail\n";
break;
case BRepCheck_PCurveIsOutOfDomainFace:
OS << "BRepCheck_PCurveIsOutOfDomainFace\n";
break;
case BRepCheck_OutOfSurfaceBoundary:
OS << "BRepCheck_OutOfSurfaceBoundary\n";
break;
default:
OS << "BRepCheck::Print(...): Undefined status!\n";
break;
}
}

View File

@@ -103,57 +103,64 @@ void BRepCheck_Analyzer::Put(const TopoDS_Shape& S,
void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
{
for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next()) {
for(TopoDS_Iterator theIterator(S);theIterator.More();theIterator.Next())
Perform(theIterator.Value());
}
//
TopAbs_ShapeEnum styp;
TopExp_Explorer exp;
//
styp = S.ShapeType();
switch (styp) {
case TopAbs_VERTEX:
switch (styp)
{
case TopAbs_VERTEX:
// modified by NIZHNY-MKK Wed May 19 16:56:16 2004.BEGIN
// There is no need to check anything.
// if (myShape.IsSame(S)) {
// myMap(S)->Blind();
// }
// modified by NIZHNY-MKK Wed May 19 16:56:23 2004.END
break;
case TopAbs_EDGE: {
case TopAbs_EDGE:
{
// Modified by skv - Tue Apr 27 11:38:08 2004 Begin
// There is no need to check anything except vertices on single edge.
// if (myShape.IsSame(S)) {
// myMap(S)->Blind();
// }
// Modified by skv - Tue Apr 27 11:38:09 2004 End
TopTools_MapOfShape MapS;
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next()) {
const TopoDS_Shape& aVertex = exp.Current();
try {
OCC_CATCH_SIGNALS
if (MapS.Add(aVertex)) {
myMap(aVertex)->InContext(S);
}
}
catch(Standard_Failure) {
TopTools_MapOfShape MapS;
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
{
const TopoDS_Shape& aVertex = exp.Current();
try
{
OCC_CATCH_SIGNALS
if (MapS.Add(aVertex))
myMap(aVertex)->InContext(S);
}
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
Handle(BRepCheck_Result) aRes = myMap(aVertex);
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(aVertex);
aRes->SetFailStatus(S);
}
}
}
if ( ! myMap(S).IsNull() )
myMap(S)->SetFailStatus(S);
Handle(BRepCheck_Result) aRes = myMap(aVertex);
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(aVertex);
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
}
break;
case TopAbs_WIRE:
@@ -171,257 +178,234 @@ void BRepCheck_Analyzer::Perform(const TopoDS_Shape& S)
case TopAbs_FACE:
{
TopTools_MapOfShape MapS;
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next()) {
try {
OCC_CATCH_SIGNALS
if (MapS.Add(exp.Current())) {
myMap(exp.Current())->InContext(S);
}
}
catch(Standard_Failure) {
for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
{
try
{
OCC_CATCH_SIGNALS
if (MapS.Add(exp.Current()))
myMap(exp.Current())->InContext(S);
}
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! myMap(S).IsNull() )
myMap(S)->SetFailStatus(S);
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (exp.Init(S,TopAbs_VERTEX);exp.More(); exp.Next())
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
}
Standard_Boolean performwire = Standard_True;
Standard_Boolean isFaceOutBoundary = Standard_False;
MapS.Clear();
for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next()) {
try {
OCC_CATCH_SIGNALS
if (MapS.Add(exp.Current())) {
Handle(BRepCheck_Result)& res = myMap(exp.Current());
res->InContext(S);
if (performwire) {
for (res->InitContextIterator();
res->MoreShapeInContext();
res->NextShapeInContext()) {
if(res->ContextualShape().IsSame(S)) {
break;
}
}
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
for (; itl.More(); itl.Next()) {
BRepCheck_Status ste = itl.Value();
if (ste == BRepCheck_NoCurveOnSurface ||
ste == BRepCheck_InvalidCurveOnSurface ||
ste == BRepCheck_InvalidRange ||
ste == BRepCheck_InvalidCurveOnClosedSurface) {
performwire = Standard_False;
break;
}
}
}
}
}
catch(Standard_Failure) {
for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next())
{
try
{
OCC_CATCH_SIGNALS
if (MapS.Add(exp.Current()))
{
Handle(BRepCheck_Result)& res = myMap(exp.Current());
res->InContext(S);
if (performwire)
{
for (res->InitContextIterator();
res->MoreShapeInContext();
res->NextShapeInContext())
{
if(res->ContextualShape().IsSame(S))
break;
}
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
for (; itl.More(); itl.Next())
{
BRepCheck_Status ste = itl.Value();
if (ste == BRepCheck_NoCurveOnSurface ||
ste == BRepCheck_InvalidCurveOnSurface ||
ste == BRepCheck_InvalidRange ||
ste == BRepCheck_InvalidCurveOnClosedSurface)
{
performwire = Standard_False;
break;
}
if(ste == BRepCheck_PCurveIsOutOfDomainFace)
{
isFaceOutBoundary = Standard_True;
break;
}
}//for (; itl.More(); itl.Next())
}//if (performwire)
}//if (MapS.Add(exp.Current()))
}
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() )
myMap(S)->SetFailStatus(S);
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (exp.Init(S,TopAbs_EDGE);exp.More(); exp.Next())
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
}
Standard_Boolean orientofwires = performwire;
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next()) {
try {
OCC_CATCH_SIGNALS
Handle(BRepCheck_Result)& res = myMap(exp.Current());
res->InContext(S);
if (orientofwires) {
for (res->InitContextIterator();
res->MoreShapeInContext();
res->NextShapeInContext()) {
if(res->ContextualShape().IsSame(S)) {
break;
}
}
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
for (; itl.More(); itl.Next()) {
BRepCheck_Status ste = itl.Value();
if (ste != BRepCheck_NoError) {
orientofwires = Standard_False;
break;
}
}
}
}
catch(Standard_Failure) {
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
{
try
{
OCC_CATCH_SIGNALS
Handle(BRepCheck_Result)& res = myMap(exp.Current());
res->InContext(S);
if (orientofwires)
{
for (res->InitContextIterator();
res->MoreShapeInContext();
res->NextShapeInContext())
{
if(res->ContextualShape().IsSame(S))
break;
}
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
}
try {
BRepCheck_ListIteratorOfListOfStatus itl(res->StatusOnShape());
for (; itl.More(); itl.Next())
{
BRepCheck_Status ste = itl.Value();
if (ste != BRepCheck_NoError)
{
orientofwires = Standard_False;
break;
}
}
}//if (orientofwires)
}
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() )
myMap(S)->SetFailStatus(S);
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
}//for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
try
{
OCC_CATCH_SIGNALS
if (performwire) {
if (orientofwires) {
Handle(BRepCheck_Face)::DownCast(myMap(S))->
OrientationOfWires(Standard_True);// on enregistre
}
// else {
// Handle(BRepCheck_Face)::DownCast(myMap(S))->
// IntersectWires(Standard_True); // on enregistre
// }
else {
Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
}
}
else {
Handle(BRepCheck_Face)::DownCast(myMap(S))->SetUnorientable();
}
if (performwire)
{
if (isFaceOutBoundary)
Handle(BRepCheck_Face)::DownCast(myMap(S))->
SetStatus(BRepCheck_OutOfSurfaceBoundary);
else if (orientofwires)
Handle(BRepCheck_Face)::DownCast(myMap(S))->
OrientationOfWires(Standard_True);// on enregistre
else
Handle(BRepCheck_Face)::DownCast(myMap(S))->
SetUnorientable();
}//if (performwire)
else
Handle(BRepCheck_Face)::DownCast(myMap(S))->
SetUnorientable();
}
catch(Standard_Failure) {
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next()) {
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
myMap(S)->SetFailStatus(exp.Current());
}
}
}
for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
{
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
myMap(S)->SetFailStatus(exp.Current());
}
}//for (exp.Init(S,TopAbs_WIRE);exp.More(); exp.Next())
}//catch(Standard_Failure)
}
break;
case TopAbs_SHELL:
case TopAbs_SHELL:
//modified by NIZNHY-PKV Mon Oct 13 14:23:53 2008f
/* {
Standard_Boolean VerifyOrientation, bFlag;
//
VerifyOrientation = Standard_True;
//
exp.Init(S,TopAbs_FACE);
for (; exp.More(); exp.Next()) {
const TopoDS_Shape& aF=exp.Current();
try {
OCC_CATCH_SIGNALS
bFlag= !(Handle(BRepCheck_Face)::DownCast(myMap(aF))->IsUnorientable());
VerifyOrientation = (VerifyOrientation && bFlag);
}
catch(Standard_Failure) {
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
} //
try {
OCC_CATCH_SIGNALS
if (VerifyOrientation) {
Handle(BRepCheck_Shell)::DownCast(myMap(S))->Orientation(Standard_True);
}
else {
Handle(BRepCheck_Shell)::DownCast(myMap(S))->SetUnorientable();
}
}
catch(Standard_Failure) {
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
exp.Init(S,TopAbs_FACE);
for (; exp.More(); exp.Next()) {
Handle(BRepCheck_Result) aRes = myMap(exp.Current());
if ( ! aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
myMap(S)->SetFailStatus(exp.Current());
}
}
}
}
*/
//modified by NIZNHY-PKV Mon Oct 13 14:24:04 2008t
break;
//
case TopAbs_SOLID: {
exp.Init(S,TopAbs_SHELL);
for (; exp.More(); exp.Next()) {
const TopoDS_Shape& aShell=exp.Current();
try {
OCC_CATCH_SIGNALS
myMap(aShell)->InContext(S);
}
catch(Standard_Failure) {
case TopAbs_SOLID:
{
exp.Init(S,TopAbs_SHELL);
for (; exp.More(); exp.Next())
{
const TopoDS_Shape& aShell=exp.Current();
try
{
OCC_CATCH_SIGNALS
myMap(aShell)->InContext(S);
}
catch(Standard_Failure)
{
#ifdef DEB
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
cout<<"BRepCheck_Analyzer : ";
Standard_Failure::Caught()->Print(cout);
cout<<endl;
#endif
if ( ! myMap(S).IsNull() ) {
myMap(S)->SetFailStatus(S);
}
//
Handle(BRepCheck_Result) aRes = myMap(aShell);
if (!aRes.IsNull() ) {
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}
if ( ! myMap(S).IsNull() )
{
myMap(S)->SetFailStatus(S);
}
//
Handle(BRepCheck_Result) aRes = myMap(aShell);
if (!aRes.IsNull() )
{
aRes->SetFailStatus(exp.Current());
aRes->SetFailStatus(S);
}
}//catch(Standard_Failure)
}//for (; exp.More(); exp.Next())
}
}
break;//case TopAbs_SOLID
break;//case TopAbs_SOLID
default:
break;
}//switch (styp) {

View File

@@ -58,12 +58,14 @@
#include <Precision.hxx>
//modified by NIZNHY-PKV Thu May 05 09:01:57 2011f
static
Standard_Boolean Validate(const Adaptor3d_Curve&,
const Adaptor3d_CurveOnSurface&,
const Standard_Real,
const Standard_Boolean);
BRepCheck_Status Validate(const Adaptor3d_Curve&,
const Adaptor3d_CurveOnSurface&,
const Standard_Real,
const Standard_Boolean,
const Standard_Boolean theSurfIsUPeriodic,
const Standard_Boolean theSurfIsVPeriodic);
static
void PrintProblematicPoint(const gp_Pnt&,
const Standard_Real,
@@ -77,13 +79,9 @@ static
static
Standard_Real PrecSurface(const Adaptor3d_CurveOnSurface& aACS);
//static Standard_Boolean Validate(const Adaptor3d_Curve&,
// const Adaptor3d_Curve&,
// const Standard_Real,
// const Standard_Boolean);
//modified by NIZNHY-PKV Thu May 05 09:02:01 2011t
#define NCONTROL 23
static const Standard_Integer aNbControl = 23;
//=======================================================================
//function : BRepCheck_Edge
@@ -213,9 +211,9 @@ void BRepCheck_Edge::Minimum()
void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
{
if (myMap.IsBound(S)) {
if (myMap.IsBound(S))
return;
}
BRepCheck_ListOfStatus thelist;
myMap.Bind(S, thelist);
BRepCheck_ListOfStatus& lst = myMap(S);
@@ -224,191 +222,238 @@ void BRepCheck_Edge::InContext(const TopoDS_Shape& S)
Standard_Real Tol = BRep_Tool::Tolerance(TopoDS::Edge(myShape));
TopAbs_ShapeEnum styp = S.ShapeType();
// for (TopExp_Explorer exp(S,TopAbs_EDGE); exp.More(); exp.Next()) {
TopExp_Explorer exp(S,TopAbs_EDGE) ;
for ( ; exp.More(); exp.Next()) {
if (exp.Current().IsSame(myShape)) {
for ( ; exp.More(); exp.Next())
{
if (exp.Current().IsSame(myShape))
break;
}
}
if (!exp.More()) {
if (!exp.More())
{
BRepCheck::Add(lst,BRepCheck_SubshapeNotInShape);
return;
}
switch (styp) {
case TopAbs_FACE:
if (!myCref.IsNull()) {
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
// Modified by skv - Tue Apr 27 11:48:13 2004 Begin
if (!SameParameter || !SameRange) {
if (!SameParameter)
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
if (!SameRange)
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
return;
}
// Modified by skv - Tue Apr 27 11:48:14 2004 End
Standard_Real First = myHCurve->FirstParameter();
Standard_Real Last = myHCurve->LastParameter();
switch (styp)
{
case TopAbs_FACE:
if (myCref.IsNull())
break;
Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &S.TShape());
const TopLoc_Location& Floc = S.Location();
const TopLoc_Location& TFloc = TF->Location();
const Handle(Geom_Surface)& Su = TF->Surface();
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
Standard_Boolean pcurvefound = Standard_False;
{
Standard_Boolean SameParameter = TE->SameParameter();
Standard_Boolean SameRange = TE->SameRange();
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L)) {
pcurvefound = Standard_True;
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
Standard_Real f,l;
GC->Range(f,l);
// gka OCC
// Modified by skv - Tue Apr 27 11:50:35 2004 Begin
// if (SameRange && (fabs(f-First) > Precision::PConfusion() || fabs(l-Last)> Precision::PConfusion())) { //f != First || l != Last)) { gka OCC
if (fabs(f-First) > Precision::PConfusion() ||
fabs(l-Last) > Precision::PConfusion()) {
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
}
// Modified by skv - Tue Apr 27 11:50:37 2004 End
if (myGctrl) {
Handle(Geom_Surface) Sb = cr->Surface();
Sb = Handle(Geom_Surface)::DownCast
// (Su->Transformed(L.Transformation()));
(Su->Transformed(/*L*/(Floc * TFloc).Transformation()));
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean ok =
Validate(myHCurve->Curve(),ACS,Tol,SameParameter);
if (!ok) {
if (cr->IsCurveOnClosedSurface()) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
}
else {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
// Modified by skv - Tue Apr 27 11:53:00 2004 Begin
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// if (SameParameter) {
// BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
// }
// Modified by skv - Tue Apr 27 11:53:01 2004 End
}
if (cr->IsCurveOnClosedSurface()) {
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
ACS.Load(GAHS); // sans doute inutile
ACS.Load(GHPC); // meme remarque...
ok = Validate(myHCurve->Curve(),ACS,Tol,SameParameter);
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
// Modified by skv - Tue Apr 27 11:53:20 2004 Begin
if (SameParameter) {
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
// Modified by skv - Tue Apr 27 11:53:23 2004 End
}
}
}
}
itcr.Next();
}
if (!SameParameter || !SameRange)
{
if (!SameParameter)
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
if (!pcurvefound) {
Handle(Geom_Plane) P;
Handle(Standard_Type) dtyp = Su->DynamicType();
if (dtyp == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
P = Handle(Geom_Plane)::DownCast
(Handle(Geom_RectangularTrimmedSurface)::
DownCast(Su)->BasisSurface());
}
else {
P = Handle(Geom_Plane)::DownCast(Su);
}
if (P.IsNull()) { // not a plane
BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
}
else { // on fait la projection a la volee, comme BRep_Tool
// plan en position
if (myGctrl) {
P = Handle(Geom_Plane)::
DownCast(P->Transformed(/*L*/(Floc * TFloc).Transformation()));// eap occ332
//on projette Cref sur ce plan
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(P);
if (!SameRange)
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
// Dub - Normalement myHCurve est une GeomAdaptor_HCurve
GeomAdaptor_Curve& Gac =
Handle(GeomAdaptor_HCurve)::DownCast(myHCurve)->ChangeCurve();
Handle(Geom_Curve) C3d = Gac.Curve();
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
P, P->Position().Direction(),
Standard_True);
Handle(GeomAdaptor_HCurve) aHCurve =
new GeomAdaptor_HCurve(ProjOnPlane);
return;
}//if (!SameParameter || !SameRange)
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
Handle(Geom2dAdaptor_HCurve) GHPC =
new Geom2dAdaptor_HCurve(PC,
myHCurve->FirstParameter(),
myHCurve->LastParameter());
const Standard_Real First = myHCurve->FirstParameter();
const Standard_Real Last = myHCurve->LastParameter();
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
Standard_Boolean ok = Validate(myHCurve->Curve(),ACS,
Tol,Standard_True); // voir dub...
if (!ok) {
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
}
}
}
Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &S.TShape());
const TopLoc_Location& Floc = S.Location();
const TopLoc_Location& TFloc = TF->Location();
const Handle(Geom_Surface)& Su = TF->Surface();
TopLoc_Location L = (Floc * TFloc).Predivided(myShape.Location());
Standard_Boolean pcurvefound = Standard_False;
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
while (itcr.More())
{
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr != myCref && cr->IsCurveOnSurface(Su,L))
{
pcurvefound = Standard_True;
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
Standard_Real f,l;
GC->Range(f,l);
if (fabs(f-First) > Precision::PConfusion() ||
fabs(l-Last) > Precision::PConfusion())
{
BRepCheck::Add(lst,BRepCheck_InvalidSameRangeFlag);
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
if (myGctrl)
{
Handle(Geom_Surface) Sb = cr->Surface();
{
Standard_Real U1Su, U2Su, V1Su, V2Su;
Standard_Real U1Sb, U2Sb, V1Sb, V2Sb;
Standard_Boolean isTrimU = Standard_False, isTrimV = Standard_False;
if(Su->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface))
{
Handle(Geom_RectangularTrimmedSurface) TS =
Handle(Geom_RectangularTrimmedSurface)::DownCast(Su);
TS->GetTrimmedFlags(isTrimU, isTrimV);
}
Su->Bounds(U1Su, U2Su, V1Su, V2Su);
Sb = Handle(Geom_Surface)::DownCast
(Su->Transformed((Floc * TFloc).Transformation()));
Sb->Bounds(U1Sb, U2Sb, V1Sb, V2Sb);
Standard_Boolean isUtr = ((Abs(U1Su - U1Sb) + Abs(U2Su - U2Sb)) > Precision::PConfusion()),
isVtr = ((Abs(V1Su - V1Sb) + Abs(V2Su - V2Sb)) > Precision::PConfusion());
if(isUtr || isVtr)
{
Handle(Geom_Surface) St = Handle(Geom_RectangularTrimmedSurface)::DownCast(Sb)->BasisSurface();
Sb = new Geom_RectangularTrimmedSurface(St, isTrimU || isUtr, isVtr || isTrimV, U1Su, U2Su, V1Su, V2Su);
}
}
Handle(Geom2d_Curve) PC = cr->PCurve();
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(Sb);
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,f,l);
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
BRepCheck_Status aStatus = Validate(myHCurve->Curve(),ACS,Tol,SameParameter,
Sb->IsUPeriodic(),Sb->IsVPeriodic());
if(aStatus == BRepCheck_PCurveIsOutOfDomainFace)
BRepCheck::Add(lst,BRepCheck_PCurveIsOutOfDomainFace);
else if(aStatus == BRepCheck_InvalidCurveOnSurface)
{
if (cr->IsCurveOnClosedSurface())
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
else
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
else if(aStatus != BRepCheck_NoError)
BRepCheck::Add(lst,aStatus);
if (cr->IsCurveOnClosedSurface())
{
GHPC->ChangeCurve2d().Load(cr->PCurve2(),f,l); // same bounds
ACS.Load(GAHS); // sans doute inutile
ACS.Load(GHPC); // meme remarque...
aStatus = Validate(myHCurve->Curve(),ACS,Tol,SameParameter,
Sb->IsUPeriodic(),Sb->IsVPeriodic());
if(aStatus == BRepCheck_PCurveIsOutOfDomainFace)
BRepCheck::Add(lst,BRepCheck_PCurveIsOutOfDomainFace);
else if(aStatus == BRepCheck_InvalidCurveOnSurface)
{
BRepCheck::Add(lst,BRepCheck_InvalidCurveOnClosedSurface);
if (SameParameter)
BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
else if(aStatus != BRepCheck_NoError)
BRepCheck::Add(lst,aStatus);
}//if (cr->IsCurveOnClosedSurface())
}//if (myGctrl)
}//if (cr != myCref && cr->IsCurveOnSurface(Su,L))
itcr.Next();
}//while (itcr.More())
if (!pcurvefound)
{
Handle(Geom_Plane) P;
Handle(Standard_Type) dtyp = Su->DynamicType();
if (dtyp == STANDARD_TYPE(Geom_RectangularTrimmedSurface))
{
P = Handle(Geom_Plane)::DownCast
(Handle(Geom_RectangularTrimmedSurface)::
DownCast(Su)->BasisSurface());
}
else
P = Handle(Geom_Plane)::DownCast(Su);
if (P.IsNull()) // not a plane
BRepCheck::Add(lst,BRepCheck_NoCurveOnSurface);
else
{
// on fait la projection a la volee, comme BRep_Tool plan en position
if (myGctrl)
{
P = Handle(Geom_Plane)::DownCast(
P->Transformed((Floc * TFloc).Transformation()));// eap occ332
//on projette Cref sur ce plan
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(P);
// Dub - Normalement myHCurve est une GeomAdaptor_HCurve
GeomAdaptor_Curve& Gac =
Handle(GeomAdaptor_HCurve)::DownCast(myHCurve)->ChangeCurve();
Handle(Geom_Curve) C3d = Gac.Curve();
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,First,Last),
P, P->Position().Direction(),Standard_True);
Handle(GeomAdaptor_HCurve) aHCurve =
new GeomAdaptor_HCurve(ProjOnPlane);
ProjLib_ProjectedCurve proj(GAHS,aHCurve);
Handle(Geom2d_Curve) PC = Geom2dAdaptor::MakeCurve(proj);
Handle(Geom2dAdaptor_HCurve) GHPC = new Geom2dAdaptor_HCurve(PC,
myHCurve->FirstParameter(),
myHCurve->LastParameter());
Adaptor3d_CurveOnSurface ACS(GHPC,GAHS);
BRepCheck_Status aStatus = Validate(myHCurve->Curve(),ACS,Tol,
Standard_True, P->IsUPeriodic(),P->IsVPeriodic()); // voir dub...
if (aStatus != BRepCheck_NoError)
BRepCheck::Add(lst,aStatus);
}//if (myGctrl)
}//else of "if (P.IsNull())" condition
}//if (!pcurvefound)
break;
}
}
break;
case TopAbs_SOLID:
{
// on verifie que l`edge est bien connectee 2 fois (pas de bord libre)
Standard_Integer nbconnection = 0;
//TopExp_Explorer exp;
for (exp.Init(S,TopAbs_FACE); exp.More(); exp.Next()) {
const TopoDS_Face& fac = TopoDS::Face(exp.Current());
TopExp_Explorer exp2;
for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next()) {
if (exp2.Current().IsSame(myShape)) {
nbconnection++;
}
}
case TopAbs_SOLID:
{
// on verifie que l`edge est bien connectee 2 fois (pas de bord libre)
Standard_Integer nbconnection = 0;
//TopExp_Explorer exp;
for (exp.Init(S,TopAbs_FACE); exp.More(); exp.Next())
{
const TopoDS_Face& fac = TopoDS::Face(exp.Current());
TopExp_Explorer exp2;
for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next())
{
if (exp2.Current().IsSame(myShape))
nbconnection++;
}//for (exp2.Init(fac,TopAbs_EDGE); exp2.More(); exp2.Next())
}//for (exp.Init(S,TopAbs_FACE); exp.More(); exp.Next())
if (nbconnection < 2 && !TE->Degenerated())
BRepCheck::Add(myMap(S),BRepCheck_FreeEdge);
else if (nbconnection > 2)
{
BRepCheck::Add(myMap(S),BRepCheck_InvalidMultiConnexity);
}
else
BRepCheck::Add(myMap(S),BRepCheck_NoError);
}
if (nbconnection < 2 && !TE->Degenerated()) {
BRepCheck::Add(myMap(S),BRepCheck_FreeEdge);
}
else if (nbconnection > 2) {
BRepCheck::Add(myMap(S),BRepCheck_InvalidMultiConnexity);
}
else {
BRepCheck::Add(myMap(S),BRepCheck_NoError);
}
}
break;
default:
break;
}
if (myMap(S).IsEmpty()) {
break;
default:
break;
}//switch (styp)
if (myMap(S).IsEmpty())
myMap(S).Append(BRepCheck_NoError);
}
}
@@ -530,8 +575,8 @@ Standard_Real BRepCheck_Edge::Tolerance()
Standard_Real dist2, tol2, tolCal=0., prm;
gp_Pnt center, othP;
Standard_Integer i;
for (i= 0; i< NCONTROL; i++) {
prm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
for (i= 0; i< aNbControl; i++) {
prm = ((aNbControl-1-i)*First + i*Last)/(aNbControl-1);
tol2=dist2=0.;
center=(*(Handle(Adaptor3d_HCurve)*)&theRep(1))->Value(prm);
for (iRep=2; iRep<=nbRep; iRep++) {
@@ -549,74 +594,383 @@ Standard_Real BRepCheck_Edge::Tolerance()
//=======================================================================
//function : Validate
//purpose :
//purpose :
//Remark : If the original surface is not periodic in U or V direction
// (for example, rectangular trimmed on periodic surface),
// the surface that <Adaptor3d_CurveOnSurface> contains
// can be periodic.
// To use true values of flags, the parameters
// <theSurfIsUPeriodic> and <theSurfIsVPeriodic> have been added.
//=======================================================================
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_CurveOnSurface& Other,
const Standard_Real Tol,
const Standard_Boolean SameParameter)
BRepCheck_Status Validate (const Adaptor3d_Curve& CRef,
const Adaptor3d_CurveOnSurface& Other,
const Standard_Real Tol,
const Standard_Boolean SameParameter,
const Standard_Boolean theSurfIsUPeriodic,
const Standard_Boolean theSurfIsVPeriodic)
{
Standard_Boolean Status, proj;
Standard_Real aPC, First, Last, Error;
gp_Pnt problematic_point ;
//
Status = Standard_True;
Error = 0.;
First = CRef.FirstParameter();
Last = CRef.LastParameter();
//
aPC=Precision::PConfusion();
proj = (!SameParameter ||
fabs(Other.FirstParameter()-First) > aPC ||
fabs( Other.LastParameter()-Last) > aPC);
if (!proj) {
Standard_Integer i;
Standard_Real Tol2, prm, dD;
gp_Pnt pref, pother;
BRepCheck_Status Status = BRepCheck_NoError;
const Standard_Real aPC = Precision::PConfusion(),
First = CRef.FirstParameter(),
Last = CRef.LastParameter();
const Standard_Boolean proj = (!SameParameter ||
fabs(Other.FirstParameter()-First) > aPC ||
fabs(Other.LastParameter()-Last) > aPC);
if (!proj)
{
//modified by NIZNHY-PKV Thu May 05 09:06:41 2011f
//OCC22428
dD=Prec(CRef, Other);//3.e-15;
Tol2=Tol+dD;
const Standard_Real dD = Prec(CRef, Other);//3.e-15;
Standard_Real Tol2=Tol+dD;
Tol2=Tol2*Tol2;
//Tol2=Tol*Tol;
//modified by NIZNHY-PKV Thu May 05 09:06:47 2011t
const Standard_Real uf = Other.GetSurface()->FirstUParameter ();
const Standard_Real ul = Other.GetSurface()->LastUParameter ();
const Standard_Real vf = Other.GetSurface()->FirstVParameter();
const Standard_Real vl = Other.GetSurface()->LastVParameter();
for (i = 0; i< NCONTROL; ++i) {
prm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
pref = CRef.Value(prm);
pother = Other.Value(prm);
if (pref.SquareDistance(pother) > Tol2) {
problematic_point = pref ;
Status = Standard_False;
Error = pref.Distance(pother);
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
//These values are used for estimation of toleranves of
//"plane-like" surfaces
const Standard_Real aDeltaU = (ul - uf);
const Standard_Real aDeltaV = (vl - vf);
//(for Rectangular trimmed surface for example)
const Standard_Boolean isBaseSurfUPeriodic = Other.GetSurface()->IsUPeriodic() && !theSurfIsUPeriodic;
const Standard_Boolean isBaseSurfVPeriodic = Other.GetSurface()->IsVPeriodic() && !theSurfIsVPeriodic;
const Standard_Boolean isUPeriodic = isBaseSurfUPeriodic || theSurfIsUPeriodic;
const Standard_Boolean isVPeriodic = isBaseSurfVPeriodic || theSurfIsVPeriodic;
const Standard_Boolean isUClosedOrPeriodic = Other.GetSurface()->IsUClosed() || theSurfIsUPeriodic;
const Standard_Boolean isVClosedOrPeriodic = Other.GetSurface()->IsVClosed() || theSurfIsVPeriodic;
const Standard_Real UResSt =Other.GetSurface()->UResolution(Tol);
const Standard_Real VResSt =Other.GetSurface()->VResolution(Tol);
// if(isUClosedOrPeriodic)
// {
// const Standard_Real aF = Other.GetCurve()->Value(First).X();
// const Standard_Real aL = Other.GetCurve()->Value(Last).X();
// const Standard_Real aDim = theSurfIsUPeriodic ?
// Other.GetSurface()->UPeriod() :
// aDeltaU;
//
// if(Abs(aL - aF) - aDim > 2 * UResSt)
// {
//#ifdef DEB
// cout << endl << "----\nFunction Validate(...); file: "
// "BRepCheck_Edge.cxx" << endl;
// if(theSurfIsUPeriodic)
// cout << "The surface is U-periodic." << endl;
// else
// cout << "The surface is U-closed." << endl;
//
// cout << "P1.X() = " << aF << "; P2.X() = " << aL << endl;
// cout << "Surface dimension D = " << aDim <<
// ". (P2.X() - P1.X()) > D." << "\n-----" << endl;
//#endif
// Status = BRepCheck_PCurveIsOutOfDomainFace;
// return Status;
// }//if(aL - aF - aT > 2* URes)
// }//if(theSurfIsUPeriodic)
//
// if(isVClosedOrPeriodic)
// {
// const Standard_Real aF = Other.GetCurve()->Value(First).Y();
// const Standard_Real aL = Other.GetCurve()->Value(Last).Y();
// const Standard_Real aDim = theSurfIsVPeriodic ?
// Other.GetSurface()->VPeriod() :
// aDeltaV;
//
// if(Abs(aL - aF) - aDim > 2 * VResSt)
// {
//#ifdef DEB
// cout << endl << "----\nFunction Validate(...); file: "
// "RepCheck_Edge.cxx" << endl;
// if(theSurfIsVPeriodic)
// cout << "The surface is V-periodic." << endl;
// else
// cout << "The surface is V-closed." << endl;
//
// cout << "P1.Y() = " << aF << "; P2.Y() = " << aL << endl;
// cout << "Surface dimension D = " << aDim <<
// ". (P2.Y() - P1.Y()) > D." << "\n-----" << endl;
//#endif
// Status = BRepCheck_PCurveIsOutOfDomainFace;
// return Status;
// }//if(aL - aF - aT > 2* VRes)
// }//if(theSurfIsVPeriodic)
Standard_Real aCriticalParameterU = First,
aCriticalParameterV = First;
Standard_Real aDeltaUmax = 0.0,
aDeltaVmax = 0.0;
Standard_Real dUmaxU = 0.0, dUmaxV = 0.0;
Standard_Real dVmaxU = 0.0, dVmaxV = 0.0;
Standard_Boolean isIntoBoundaries = Standard_True;
for (Standard_Integer i = 0; i < aNbControl; ++i)
{
const Standard_Real prm = ((aNbControl-1-i)*First + i*Last)/(aNbControl-1);
const gp_Pnt pref = CRef.Value(prm);
const gp_Pnt pother = Other.Value(prm);
if (pref.SquareDistance(pother) > Tol2)
{
const gp_Pnt problematic_point(pref) ;
Status = BRepCheck_InvalidCurveOnSurface;
const Standard_Real Error = pref.Distance(pother);
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
}
}
}
else {
const gp_Pnt2d CP = Other.GetCurve()->Value(prm);
if(isUClosedOrPeriodic && isVClosedOrPeriodic)
continue;
const Standard_Real u = Max(uf, Min(CP.X(), ul));
const Standard_Real v = Max(vf, Min(CP.Y(), vl));
const Standard_Boolean isUbound = ((uf <= CP.X()) && (CP.X() <= ul)) || isUClosedOrPeriodic,
isVbound = ((vf <= CP.Y()) && (CP.Y() <= vl)) || isVClosedOrPeriodic;
//Point CP is in surface boundary.
if(isUbound && isVbound)
continue;
isIntoBoundaries = Standard_False;
//Values of overrun of surface boundaries
const Standard_Real dUpar = (isUPeriodic || isUbound) ? 0.0 : CP.X() - u,
dVpar = (isVPeriodic || isVbound) ? 0.0 : CP.Y() - v;
if(Abs(dUpar) > aDeltaUmax)
{
aCriticalParameterU = prm;
aDeltaUmax = Abs(dUpar);
dUmaxU = dUpar;
dUmaxV = dVpar;
}
if(Abs(dVpar) > aDeltaVmax)
{
aCriticalParameterV = prm;
aDeltaVmax = Abs(dVpar);
dVmaxU = dUpar;
dVmaxV = dVpar;
}
}//for (i = 0; i< aNbControl; ++i)
if(!isIntoBoundaries)
{
// Max U(V) resolution is calculated from condition:
// |S'|*dU > aCoeff*(0.5*|S"|dU*dU), it means that
// first order differential of surface >> second order one
const Standard_Real aCoeff = 10.;
//Value to check modulus of derivatives against zero
const Standard_Real eps = 1.e-16;
//Value for estimation Max resolution if |S"| < eps
const Standard_Real aFactor = 10.;
for(Standard_Integer anIndex = 0; anIndex < 2; anIndex++)
{
const Standard_Real aParam = !anIndex ? aCriticalParameterU : aCriticalParameterV;
const Standard_Real du = !anIndex ? dUmaxU : dUmaxV;
const Standard_Real dv = !anIndex ? dVmaxU : dVmaxV;
const gp_Pnt2d CP = Other.GetCurve()->Value(aParam);
const Standard_Real u = Max(uf, Min(CP.X(), ul));
const Standard_Real v = Max(vf, Min(CP.Y(), vl));
gp_Pnt aPref;
gp_Vec aDSdu, aDSdv, aD2Sdu2, aD2Sdv2, aD2Sdudv;
Other.GetSurface()->D2(u, v, aPref, aDSdu, aDSdv, aD2Sdu2, aD2Sdv2, aD2Sdudv);
Standard_Real UResMax = 0.0, VResMax = 0.0;
const Standard_Real aModDSdu = aDSdu.Magnitude();
const Standard_Real aModDSdv = aDSdv.Magnitude();
const Standard_Real aModD2Sdu2 = aD2Sdu2.Magnitude();
const Standard_Real aModD2Sdv2 = aD2Sdv2.Magnitude();
if(aModDSdu > eps)
{
if(aModD2Sdu2 > aModDSdu / aCoeff)
{
UResMax = aModDSdu / (.5 * aCoeff * aModD2Sdu2);
}
else
{
//Surface seems to be "plane-like" in U direction
UResMax = aDeltaU / aFactor;
}
}
else
{
UResMax = aFactor * UResSt;
}
if(aModDSdv > eps)
{
if(aModD2Sdv2 > aModDSdv / aCoeff)
{
VResMax = aModDSdv / (5. * aModD2Sdv2);
}
else
{
//Surface seems to be "plane-like" in V direction
VResMax = aDeltaV / aFactor;
}
}
else
{
VResMax = aFactor * VResSt;
}
const Standard_Real anURes = isBaseSurfUPeriodic ? UResSt : UResMax,
aVRes = isBaseSurfVPeriodic ? VResSt : VResMax;
const Standard_Boolean isUbound = ((uf - anURes <= CP.X()) && (CP.X() <= ul + anURes)) || isUClosedOrPeriodic,
isVbound = ((vf - aVRes <= CP.Y()) && (CP.Y() <= vl + aVRes)) || isVClosedOrPeriodic;
if(isUbound && isVbound)
continue;
#ifdef DEB
if(!isUbound)
{
cout << endl << "----\nFunction Validate(...); file: "
"BRepCheck_Edge.cxx" << endl;
if(isBaseSurfUPeriodic)
cout << "RTS from U-periodic" << endl;
else if(theSurfIsUPeriodic)
cout << "U-periodic surface" << endl;
else if(isUClosedOrPeriodic)
cout << "U-closed surface" << endl;
cout << "Point(prm = " << aParam << "): (" <<
CP.X() << "; " << CP.Y() <<")." << endl;
cout << "u = (" << uf << ")...(" << ul << "). "
"Delta = " << Max(uf - CP.X(),CP.X()-ul) << " Tol3D = " << Tol <<
". URes = " << anURes << "\n-----" << endl;
}
if(!isVbound)
{
cout << endl << "----\nFunction Validate(...); file: "
"BRepCheck_Edge.cxx" << endl;
if(isBaseSurfVPeriodic)
cout << "RTS from V-periodic" << endl;
else if(theSurfIsVPeriodic)
cout << "V-periodic surface" << endl;
else if(isVClosedOrPeriodic)
cout << "V-closed surface" << endl;
cout << "Point(prm = " << aParam << "): (" <<
CP.X() << "; " << CP.Y() <<")." << endl;
cout << "v = (" << vf << ")...(" << vl << "). "
"Delta = " << Max(vf - CP.Y(),CP.Y()-vl) << " Tol3D = " << Tol <<
". VRes = " << aVRes << "\n-----" << endl;
}
#endif
//Expected and real point
gp_Pnt aPe, aPf;
//1st degree estimation
aPe.SetXYZ(gp_XYZ(aPref.X() + (aDSdu.X()*du+aDSdv.X()*dv),
aPref.Y() + (aDSdu.Y()*du+aDSdv.Y()*dv),
aPref.Z() + (aDSdu.Z()*du+aDSdv.Z()*dv)));
Other.GetSurface()->D0(CP.X(), CP.Y(), aPf);
const Standard_Real aTol = Tol2;
Standard_Real dist = aPe.SquareDistance(aPf);
if(dist < aTol)
continue;
#ifdef DEB
cout << endl << "++++\nFunction Validate(...); file: "
"BRepCheck_Edge.cxx (1st degree)" << endl;
cout << "Exp. point: (" << aPe.X() << ", " << aPe.Y() << ", " <<
aPe.Z() << ")." << endl;
cout << "Real point: (" << aPf.X() << ", " << aPf.Y() << ", " <<
aPf.Z() << ")." << endl;
cout << "dist**2 = " << dist <<
"; Tol = " << aTol << "\n-----" << endl;
#endif
const Standard_Real dUpar2 = du*du;
const Standard_Real dVpar2 = dv*dv;
const Standard_Real dUVpar = du*dv;
//2nd degree estimation
aPe.SetXYZ(gp_XYZ(aPe.X() + (aD2Sdu2.X()*dUpar2 +
2.0*aD2Sdudv.X()*dUVpar + aD2Sdv2.X()*dVpar2)/2.0,
aPe.Y() + (aD2Sdu2.Y()*dUpar2 +
2.0*aD2Sdudv.Y()*dUVpar + aD2Sdv2.Y()*dVpar2)/2.0,
aPe.Z() + (aD2Sdu2.Z()*dUpar2 +
2.0*aD2Sdudv.Z()*dUVpar + aD2Sdv2.Z()*dVpar2)/2.0));
dist = aPe.SquareDistance(aPf);
if(dist > aTol)
{
#ifdef DEB
cout << endl << "++++\nFunction Validate(...); file: "
"BRepCheck_Edge.cxx (2nd degree)" << endl;
cout << "Exp. point: (" << aPe.X() << ", " << aPe.Y() << ", " <<
aPe.Z() << ")." << endl;
cout << "Real point: (" << aPf.X() << ", " << aPf.Y() << ", " <<
aPf.Z() << ")." << endl;
cout << "dist**2 = " << dist <<
"; Tol = " << aTol << "\n-----" << endl;
#endif
Status = BRepCheck_PCurveIsOutOfDomainFace;
return Status;
}
}//for(Standard_Integer anIndex = 0; anIndex < 2; anIndex++)
}//if(!isIntoBoundaries)
}//if (!proj)
else
{
Extrema_LocateExtPC refd,otherd;
Standard_Real OFirst = Other.FirstParameter();
Standard_Real OLast = Other.LastParameter();
gp_Pnt pd = CRef.Value(First);
gp_Pnt pdo = Other.Value(OFirst);
Standard_Real distt = pd.SquareDistance(pdo);
if (distt > Tol*Tol) {
problematic_point = pd ;
Status = Standard_False ;
Error = Sqrt(distt);
if (distt > Tol*Tol)
{
const gp_Pnt problematic_point(pd);
Status = BRepCheck_InvalidCurveOnSurface ;
const Standard_Real Error = Sqrt(distt);
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
}
pd = CRef.Value(Last);
pdo = Other.Value(OLast);
distt = pd.SquareDistance(pdo);
if (distt > Tol*Tol) {
problematic_point = pd ;
Status = Standard_False ;
Error = Sqrt(distt);
if (distt > Tol*Tol)
{
const gp_Pnt problematic_point(pd);
Status = BRepCheck_InvalidCurveOnSurface ;
const Standard_Real Error = Sqrt(distt);
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
@@ -624,57 +978,50 @@ Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
refd.Initialize(CRef,First,Last,CRef.Resolution(Tol));
otherd.Initialize(Other,OFirst,OLast,Other.Resolution(Tol));
for (Standard_Integer i = 2; i< NCONTROL-1; i++) {
Standard_Real rprm = ((NCONTROL-1-i)*First + i*Last)/(NCONTROL-1);
for (Standard_Integer i = 2; i< aNbControl-1; i++)
{
Standard_Real rprm = ((aNbControl-1-i)*First + i*Last)/(aNbControl-1);
gp_Pnt pref = CRef.Value(rprm);
Standard_Real oprm = ((NCONTROL-1-i)*OFirst + i*OLast)/(NCONTROL-1);
Standard_Real oprm = ((aNbControl-1-i)*OFirst + i*OLast)/(aNbControl-1);
gp_Pnt pother = Other.Value(oprm);
refd.Perform(pother,rprm);
if (!refd.IsDone() || refd.SquareDistance() > Tol * Tol) {
problematic_point = pref ;
Status = Standard_False ;
if (refd.IsDone()) {
Error = sqrt (refd.SquareDistance());
}
else {
Error = RealLast();
}
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
if (!refd.IsDone() || refd.SquareDistance() > Tol * Tol)
{
const gp_Pnt problematic_point(pref);
Status = BRepCheck_InvalidCurveOnSurface ;
const Standard_Real Error = refd.IsDone() ?
sqrt (refd.SquareDistance()) :
RealLast();
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
}
otherd.Perform(pref,oprm);
if (!otherd.IsDone() || otherd.SquareDistance() > Tol * Tol) {
problematic_point = pref ;
Status = Standard_False ;
if (otherd.IsDone()) {
Error = sqrt (otherd.SquareDistance());
}
else {
Error = RealLast();
}
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
if (!otherd.IsDone() || otherd.SquareDistance() > Tol * Tol)
{
const gp_Pnt problematic_point(pref);
Status = BRepCheck_InvalidCurveOnSurface ;
const Standard_Real Error = otherd.IsDone() ?
sqrt (otherd.SquareDistance()) :
RealLast();
PrintProblematicPoint(problematic_point, Error, Tol);
return Status;
//goto FINISH ;
}
}
}
//FINISH :
/*
#ifdef DEB
if (! Status) {
cout << " **** probleme de SameParameter au point :" << endl;
cout << " " << problematic_point.Coord(1) << " "
<< problematic_point.Coord(2) << " "
<< problematic_point.Coord(3) << endl ;
cout << " Erreur detectee :" << Error << " Tolerance :" << Tol << endl;
}
#endif
*/
return Status ;
return Status ;
}
//=======================================================================
//function : Prec
//purpose :

View File

@@ -66,6 +66,13 @@ is
is static;
SetStatus(me: mutable;
theStatus:Status from BRepCheck)
--- Purpose: Sets status of Face;
is static;
IsUnorientable(me)

View File

@@ -494,6 +494,15 @@ void BRepCheck_Face::SetUnorientable()
BRepCheck::Add(myMap(myShape),BRepCheck_UnorientableShape);
}
//=======================================================================
//function : SetStatus
//purpose :
//=======================================================================
void BRepCheck_Face::SetStatus(const BRepCheck_Status theStatus)
{
BRepCheck::Add(myMap(myShape),theStatus);
}
//=======================================================================
//function : IsUnorientable

View File

@@ -384,7 +384,7 @@ Standard_Boolean IsDistanceIn3DTolerance (const BRepAdaptor_Surface& /*aFaceSurf
#ifdef DEB
cout << endl;
cout << "--------Function IsDistanceIn3DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Closed3d -> Error" << endl;
cout << "--- BRepCheck Wire: Not closed in 3D" << endl;
cout << "--- Dist (" << Dist << ") > Tol3d (" << aTol3d << ")" << endl;
cout << "Pnt1(" << thePnt_f.X() << "; " << thePnt_f.Y() << "; " << thePnt_f.Z() << ")" << endl;
cout << "Pnt2(" << thePnt_l.X() << "; " << thePnt_l.Y() << "; " << thePnt_l.Z() << ")" << endl;
@@ -422,7 +422,7 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
{
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2d" << endl;
cout << "--- BRepCheck Wire: Not closed in 2D" << endl;
cout << "*****************************************************" << endl;
cout << "*dumin = " << dumin << "; dumax = " << dumax << endl;
cout << "* dvmin = " << dvmin << "; dvmax = " << dvmax << endl;
@@ -471,7 +471,7 @@ Standard_Boolean IsDistanceIn2DTolerance (const BRepAdaptor_Surface& aFaceSurfac
{
cout << endl;
cout << "--------Function IsDistanceIn2DTolerance(...)----------" << endl;
cout << "--- BRepCheck Wire: Not closed in 2d" << endl;
cout << "--- BRepCheck Wire: Not closed in 2D" << endl;
cout << "*****************************************************" << endl;
cout << "* Dist = " << Dist << " > Tol2d = " << aTol2d << endl;
cout << "*****************************************************" << endl;

View File

@@ -45,23 +45,26 @@ is
class EdgeTool;
class Face;
class Domain;
class Cinert;
class Sinert;
class Vinert;
class VinertGK;
class UFunction;
class TFunction;
class Domain;
class Cinert instantiates CGProps from GProp( Curve from BRepAdaptor,
EdgeTool from BRepGProp);
class Sinert instantiates SGProps from GProp( Edge from TopoDS,
Face from BRepGProp ,
Domain from BRepGProp);
class Vinert instantiates VGProps from GProp( Edge from TopoDS,
Face from BRepGProp,
Domain from BRepGProp);
class VinertGK instantiates VGPropsGK from GProp( Edge from TopoDS,
Face from BRepGProp,
Domain from BRepGProp);
--
-- Package methods to compute global properties.
--
--
LinearProperties(S : Shape from TopoDS; LProps : in out GProps from GProp);
---Purpose: Computes the linear global properties of the shape S,
@@ -230,3 +233,7 @@ is
end BRepGProp;

View File

@@ -13,24 +13,23 @@
// commercial license or contractual agreement.
#include <BRepGProp_Face.ixx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <math.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Precision.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom2d_Line.hxx>
//=======================================================================
//function : UIntegrationOrder
@@ -38,33 +37,32 @@
//=======================================================================
Standard_Integer BRepGProp_Face::UIntegrationOrder() const {
Standard_Integer Nu;
switch (mySurface.GetType()) {
Standard_Integer Nu;
switch (mySurface.GetType())
{
case GeomAbs_Plane :
Nu =4;
break;
case GeomAbs_Plane :
Nu =4;
break;
case GeomAbs_BezierSurface :
{
Nu = (*((Handle(Geom_BezierSurface)*)&((mySurface.Surface()).Surface())))->UDegree()+1;
Nu = Max(4,Nu);
}
break;
case GeomAbs_BSplineSurface :
{
Standard_Integer a = (*((Handle(Geom_BSplineSurface)*)&((mySurface.Surface()).Surface())))->UDegree()+1;
Standard_Integer b = (*((Handle(Geom_BSplineSurface)*)&((mySurface.Surface()).Surface())))->NbUKnots()-1;
Nu = Max(4,a*b);
}
break;
case GeomAbs_BezierSurface :
{
Nu = (*((Handle(Geom_BezierSurface)*)&((mySurface.Surface()).Surface())))->UDegree()+1;
Nu = Max(4,Nu);
}
break;
case GeomAbs_BSplineSurface :
{
Standard_Integer a = (*((Handle(Geom_BSplineSurface)*)&((mySurface.Surface()).Surface())))->UDegree()+1;
Standard_Integer b = (*((Handle(Geom_BSplineSurface)*)&((mySurface.Surface()).Surface())))->NbUKnots()-1;
Nu = Max(4,a*b);
}
break;
default :
Nu = 9;
break;
}
default :
Nu = 9;
break;
}
return Max(8,2*Nu);
}

View File

@@ -1,126 +0,0 @@
-- Created on: 2005-12-21
-- Created by: Sergey KHROMOV
-- Copyright (c) 2005-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TFunction from BRepGProp inherits Function from math
---Purpose: This class represents the integrand function for the outer
-- integral computation. The returned value represents the
-- integral of UFunction. It depends on the value type and the
-- flag IsByPoint.
uses
Pnt from gp,
Address from Standard,
Boolean from Standard,
Integer from Standard,
Real from Standard,
ValueType from GProp,
UFunction from BRepGProp,
Face from BRepGProp
is
Create(theSurface : Face from BRepGProp;
theVertex : Pnt from gp;
IsByPoint : Boolean from Standard;
theCoeffs : Address from Standard;
theUMin : Real from Standard;
theTolerance: Real from Standard)
---Purpose: Constructor. Initializes the function with the face, the
-- location point, the flag IsByPoint, the coefficients
-- theCoeff that have different meaning depending on the value
-- of IsByPoint. The last two parameters are theUMin - the
-- lower bound of the inner integral. This value is fixed for
-- any integral. And the value of tolerance of inner integral
-- computation.
-- If IsByPoint is equal to Standard_True, the number of the
-- coefficients is equal to 3 and they represent X, Y and Z
-- coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
-- correspondingly) of the shift if the inertia is computed
-- with respect to the point different then the location.
-- If IsByPoint is equal to Standard_False, the number of the
-- coefficients is 4 and they represent the compbination of
-- plane parameters and shift values.
returns TFunction from BRepGProp;
Init(me: in out);
SetNbKronrodPoints(me: in out; theNbPoints: Integer from Standard);
---Purpose: Setting the expected number of Kronrod points for the outer
-- integral computation. This number is required for
-- computation of a value of tolerance for inner integral
-- computation. After GetStateNumber method call, this number
-- is recomputed by the same law as in
-- math_KronrodSingleIntegration, i.e. next number of points
-- is equal to the current number plus a square root of the
-- current number. If the law in math_KronrodSingleIntegration
-- is changed, the modification algo should be modified
-- accordingly.
---C++: inline
SetValueType(me: in out; aType: ValueType from GProp);
---Purpose: Setting the type of the value to be returned. This
-- parameter is directly passed to the UFunction.
---C++: inline
SetTolerance(me: in out; aTol: Real from Standard);
---Purpose: Setting the tolerance for inner integration
---C++: inline
ErrorReached(me)
---Purpose: Returns the relative reached error of all values computation since
-- the last call of GetStateNumber method.
---C++: inline
returns Real from Standard;
AbsolutError(me)
---Purpose: Returns the absolut reached error of all values computation since
-- the last call of GetStateNumber method.
---C++: inline
returns Real from Standard;
Value(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Returns a value of the function. The value represents an
-- integral of UFunction. It is computed with the predefined
-- tolerance using the adaptive Gauss-Kronrod method.
returns Boolean from Standard
is redefined;
GetStateNumber(me: in out)
---Purpose: Redefined method. Remembers the error reached during
-- computation of integral values since the object creation
-- or the last call of GetStateNumber. It is invoked in each
-- algorithm from the package math. Particularly in the
-- algorithm math_KronrodSingleIntegration that is used to
-- compute the integral of TFunction.
returns Integer
is redefined;
fields
mySurface : Face from BRepGProp;
myUFunction : UFunction from BRepGProp;
myUMin : Real from Standard;
myTolerance : Real from Standard;
myTolReached: Real from Standard;
myErrReached: Real from Standard;
myAbsError : Real from Standard;
myValueType : ValueType from GProp;
myIsByPoint : Boolean from Standard;
myNbPntOuter: Integer from Standard;
end TFunction;

View File

@@ -1,129 +0,0 @@
-- Created on: 2005-12-21
-- Created by: Sergey KHROMOV
-- Copyright (c) 2005-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class UFunction from BRepGProp inherits Function from math
---Purpose: This class represents the integrand function for
-- computation of an inner integral. The returned value
-- depends on the value type and the flag IsByPoint.
--
-- The type of returned value is the one of the following
-- values:
-- - GProp_Mass - volume computation.
-- - GProp_CenterMassX, GProp_CenterMassY,
-- GProp_CenterMassZ - X, Y and Z coordinates of center
-- of mass computation.
-- - GProp_InertiaXX, GProp_InertiaYY, GProp_InertiaZZ,
-- GProp_InertiaXY, GProp_InertiaXZ, GProp_InertiaYZ
-- - moments of inertia computation.
--
-- If the flag IsByPoint is set to Standard_True, the value is
-- returned for the region of space that is delimited by a
-- surface and a point. Otherwise all computations are
-- performed for the region of space delimited by a surface
-- and a plane.
uses
Pnt from gp,
XYZ from gp,
Address from Standard,
Boolean from Standard,
Real from Standard,
ValueType from GProp,
Face from BRepGProp
is
Create(theSurface: Face from BRepGProp;
theVertex : Pnt from gp;
IsByPoint : Boolean from Standard;
theCoeffs : Address from Standard)
---Purpose: Constructor. Initializes the function with the face, the
-- location point, the flag IsByPoint and the coefficients
-- theCoeff that have different meaning depending on the value
-- of IsByPoint.
-- If IsByPoint is equal to Standard_True, the number of the
-- coefficients is equal to 3 and they represent X, Y and Z
-- coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
-- correspondingly) of the shift, if the inertia is computed
-- with respect to the point different then the location.
-- If IsByPoint is equal to Standard_False, the number of the
-- coefficients is 4 and they represent the combination of
-- plane parameters and shift values.
returns UFunction from BRepGProp;
SetValueType(me: in out; theType: ValueType from GProp);
---Purpose: Setting the type of the value to be returned.
---C++: inline
SetVParam(me: in out; theVParam: Real from Standard);
---Purpose: Setting the V parameter that is constant during the
-- integral computation.
---C++: inline
Value(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Returns a value of the function.
returns Boolean from Standard
is redefined;
-----------------------
-- Private methods --
-----------------------
VolumeValue(me: in out; X : Real from Standard;
thePMP0: out XYZ from gp;
theS : out Real from Standard;
theD1 : out Real from Standard)
---Purpose: Private method. Returns the value for volume computation.
-- Other returned values are:
-- - thePMP0 - PSurf(X,Y) minus Location.
-- - theS and theD1 coeffitients that are computed and used
-- for computation of center of mass and inertia values
-- by plane.
returns Real from Standard
is private;
CenterMassValue(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Private method. Returns a value for the center of mass
-- computation. If the value type other then GProp_CenterMassX,
-- GProp_CenterMassY or GProp_CenterMassZ this method returns
-- Standard_False. Returns Standard_True in case of successful
-- computation of a value.
returns Boolean from Standard
is private;
InertiaValue(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Private method. Computes the value of intertia. The type of
-- a value returned is defined by the value type. If it is
-- other then GProp_InertiaXX, GProp_InertiaYY,
-- GProp_InertiaZZ, GProp_InertiaXY, GProp_InertiaXZ or
-- GProp_InertiaYZ, the method returns Standard_False. Returns
-- Standard_True in case of successful computation of a value
returns Boolean from Standard
is private;
fields
mySurface : Face from BRepGProp;
myVertex : Pnt from gp;
myCoeffs : Address from Standard;
myVParam : Real from Standard;
myValueType: ValueType from GProp;
myIsByPoint: Boolean from Standard;
end UFunction;

View File

@@ -1,965 +0,0 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepGProp_Vinert.ixx>
#include <math.hxx>
#include <TColStd_Array1OfReal.hxx>
class HMath_Vector{
math_Vector *pvec;
void operator=(const math_Vector&){}
public:
HMath_Vector(){ pvec = 0;}
HMath_Vector(math_Vector* pv){ pvec = pv;}
~HMath_Vector(){ if(pvec != 0) delete pvec;}
void operator=(math_Vector* pv){ if(pvec != pv && pvec != 0) delete pvec; pvec = pv;}
Standard_Real& operator()(Standard_Integer i){ return (*pvec).operator()(i);}
const Standard_Real& operator()(Standard_Integer i) const{ return (*pvec).operator()(i);}
const math_Vector* operator->() const{ return pvec;}
math_Vector* operator->(){ return pvec;}
math_Vector* Init(Standard_Real v, Standard_Integer i = 0, Standard_Integer iEnd = 0){
if(pvec == 0) return pvec;
if(iEnd - i == 0) pvec->Init(v);
else for(; i <= iEnd; i++) pvec->operator()(i) = v;
return pvec;
}
};
//Minimal value of interval's range for computation | minimal value of "dim" | ...
static Standard_Real EPS_PARAM = Precision::Angular(), EPS_DIM = 1.E-30, ERROR_ALGEBR_RATIO = 2.0/3.0;
//Maximum of GaussPoints on a subinterval and maximum of subintervals
static Standard_Integer GPM = math::GaussPointsMax(), SUBS_POWER = 32, SM = SUBS_POWER*GPM + 1;
static Standard_Boolean IS_MIN_DIM = 1; // if the value equal 0 error of algorithm calculted by static moments
static math_Vector LGaussP0(1,GPM), LGaussW0(1,GPM),
LGaussP1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM))), LGaussW1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM)));
static HMath_Vector L1 = new math_Vector(1,SM), L2 = new math_Vector(1,SM),
DimL = new math_Vector(1,SM), ErrL = new math_Vector(1,SM), ErrUL = new math_Vector(1,SM,0.0),
IxL = new math_Vector(1,SM), IyL = new math_Vector(1,SM), IzL = new math_Vector(1,SM),
IxxL = new math_Vector(1,SM), IyyL = new math_Vector(1,SM), IzzL = new math_Vector(1,SM),
IxyL = new math_Vector(1,SM), IxzL = new math_Vector(1,SM), IyzL = new math_Vector(1,SM);
static math_Vector* LGaussP[] = {&LGaussP0,&LGaussP1};
static math_Vector* LGaussW[] = {&LGaussW0,&LGaussW1};
static math_Vector UGaussP0(1,GPM), UGaussW0(1,GPM),
UGaussP1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM))), UGaussW1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM)));
static HMath_Vector U1 = new math_Vector(1,SM), U2 = new math_Vector(1,SM),
DimU = new math_Vector(1,SM), ErrU = new math_Vector(1,SM,0.0),
IxU = new math_Vector(1,SM), IyU = new math_Vector(1,SM), IzU = new math_Vector(1,SM),
IxxU = new math_Vector(1,SM), IyyU = new math_Vector(1,SM), IzzU = new math_Vector(1,SM),
IxyU = new math_Vector(1,SM), IxzU = new math_Vector(1,SM), IyzU = new math_Vector(1,SM);
static math_Vector* UGaussP[] = {&UGaussP0,&UGaussP1};
static math_Vector* UGaussW[] = {&UGaussW0,&UGaussW1};
static Standard_Integer FillIntervalBounds(Standard_Real A, Standard_Real B, const TColStd_Array1OfReal& Knots,
HMath_Vector& VA, HMath_Vector& VB)
{
Standard_Integer i = 1, iEnd = Knots.Upper(), j = 1, k = 1;
VA(j++) = A;
for(; i <= iEnd; i++){
Standard_Real kn = Knots(i);
if(A < kn)
{
if(kn < B)
{
VA(j++) = VB(k++) = kn;
}
else
{
break;
}
}
}
VB(k) = B;
return k;
}
static inline Standard_Integer MaxSubs(Standard_Integer n, Standard_Integer coeff = SUBS_POWER){
return n = IntegerLast()/coeff < n? IntegerLast(): n*coeff + 1;
}
static Standard_Integer LFillIntervalBounds(Standard_Real A, Standard_Real B, const TColStd_Array1OfReal& Knots,
const Standard_Integer NumSubs)
{
Standard_Integer iEnd = Knots.Upper(), jEnd = L1->Upper();
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:50 2003
iEnd = Max(iEnd, MaxSubs(iEnd-1,NumSubs));
if(iEnd - 1 > jEnd){
// iEnd = MaxSubs(iEnd-1,NumSubs);
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:51 2003
L1 = new math_Vector(1,iEnd); L2 = new math_Vector(1,iEnd);
DimL = new math_Vector(1,iEnd); ErrL = new math_Vector(1,iEnd,0.0); ErrUL = new math_Vector(1,iEnd,0.0);
IxL = new math_Vector(1,iEnd); IyL = new math_Vector(1,iEnd); IzL = new math_Vector(1,iEnd);
IxxL = new math_Vector(1,iEnd); IyyL = new math_Vector(1,iEnd); IzzL = new math_Vector(1,iEnd);
IxyL = new math_Vector(1,iEnd); IxzL = new math_Vector(1,iEnd); IyzL = new math_Vector(1,iEnd);
}
return FillIntervalBounds(A, B, Knots, L1, L2);
}
static Standard_Integer UFillIntervalBounds(Standard_Real A, Standard_Real B, const TColStd_Array1OfReal& Knots,
const Standard_Integer NumSubs)
{
Standard_Integer iEnd = Knots.Upper(), jEnd = U1->Upper();
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:50 2003
iEnd = Max(iEnd, MaxSubs(iEnd-1,NumSubs));
if(iEnd - 1 > jEnd){
// iEnd = MaxSubs(iEnd-1,NumSubs);
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:51 2003
U1 = new math_Vector(1,iEnd); U2 = new math_Vector(1,iEnd);
DimU = new math_Vector(1,iEnd); ErrU = new math_Vector(1,iEnd,0.0);
IxU = new math_Vector(1,iEnd); IyU = new math_Vector(1,iEnd); IzU = new math_Vector(1,iEnd);
IxxU = new math_Vector(1,iEnd); IyyU = new math_Vector(1,iEnd); IzzU = new math_Vector(1,iEnd);
IxyU = new math_Vector(1,iEnd); IxzU = new math_Vector(1,iEnd); IyzU = new math_Vector(1,iEnd);
}
return FillIntervalBounds(A, B, Knots, U1, U2);
}
static Standard_Real CCompute(BRepGProp_Face& S, BRepGProp_Domain& D, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia,
const Standard_Real EpsDim,
const Standard_Boolean isErrorCalculation, const Standard_Boolean isVerifyComputation)
{
Standard_Boolean isNaturalRestriction = S.NaturalRestriction();
Standard_Integer NumSubs = SUBS_POWER;
Standard_Boolean isMinDim = IS_MIN_DIM;
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
Dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
//boundary curve parametrization
Standard_Real l1, l2, lm, lr, l;
//BRepGProp_Face parametrization in U and V direction
Standard_Real BV1, BV2, v;
Standard_Real BU1, BU2, u1, u2, um, ur, u;
S.Bounds (BU1, BU2, BV1, BV2); u1 = BU1;
//location point used to compute the inertia
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
//location point used to compute the inertiard (xloc, yloc, zloc);
//Jacobien (x, y, z) -> (u, v) = ||n||
Standard_Real xn, yn, zn, s, ds, dDim;
Standard_Real x, y, z, xi, px, py, pz, yi, zi, d1, d2, d3;
//On the BRepGProp_Face
gp_Pnt Ps;
gp_Vec VNor;
//On the boundary curve u-v
gp_Pnt2d Puv;
gp_Vec2d Vuv;
Standard_Real Dul; // Dul = Du / Dl
Standard_Real CDim[2], CIx, CIy, CIz, CIxx[2], CIyy[2], CIzz[2], CIxy, CIxz, CIyz;
Standard_Real LocDim[2], LocIx[2], LocIy[2], LocIz[2], LocIxx[2], LocIyy[2], LocIzz[2], LocIxy[2], LocIxz[2], LocIyz[2];
Standard_Integer iD = 0, NbLSubs, iLS, iLSubEnd, iGL, iGLEnd, NbLGaussP[2], LRange[2], iL, kL, kLEnd, IL, JL;
Standard_Integer i, NbUSubs, iUS, iUSubEnd, iGU, iGUEnd, NbUGaussP[2], URange[2], iU, kU, kUEnd, IU, JU;
Standard_Integer UMaxSubs, LMaxSubs;
Standard_Real ErrorU, ErrorL, ErrorLMax = 0.0, Eps=0.0, EpsL=0.0, EpsU=0.0;
iGLEnd = isErrorCalculation? 2: 1;
for(i = 0; i < 2; i++) {
LocDim[i] = 0.0;
LocIx[i] = 0.0;
LocIy[i] = 0.0;
LocIz[i] = 0.0;
LocIxx[i] = 0.0;
LocIyy[i] = 0.0;
LocIzz[i] = 0.0;
LocIxy[i] = 0.0;
LocIyz[i] = 0.0;
LocIxz[i] = 0.0;
}
NbUGaussP[0] = S.SIntOrder(EpsDim);
NbUGaussP[1] = RealToInt(Ceiling(ERROR_ALGEBR_RATIO*NbUGaussP[0]));
math::GaussPoints(NbUGaussP[0],UGaussP0); math::GaussWeights(NbUGaussP[0],UGaussW0);
math::GaussPoints(NbUGaussP[1],UGaussP1); math::GaussWeights(NbUGaussP[1],UGaussW1);
NbUSubs = S.SUIntSubs();
TColStd_Array1OfReal UKnots(1,NbUSubs+1);
S.UKnots(UKnots);
while (isNaturalRestriction || D.More()) {
if(isNaturalRestriction){
NbLGaussP[0] = Min(2*NbUGaussP[0],math::GaussPointsMax());
}else{
S.Load(D.Value()); ++iD;
NbLGaussP[0] = S.LIntOrder(EpsDim);
}
NbLGaussP[1] = RealToInt(Ceiling(ERROR_ALGEBR_RATIO*NbLGaussP[0]));
math::GaussPoints(NbLGaussP[0],LGaussP0); math::GaussWeights(NbLGaussP[0],LGaussW0);
math::GaussPoints(NbLGaussP[1],LGaussP1); math::GaussWeights(NbLGaussP[1],LGaussW1);
NbLSubs = isNaturalRestriction? S.SVIntSubs(): S.LIntSubs();
TColStd_Array1OfReal LKnots(1,NbLSubs+1);
if(isNaturalRestriction){
S.VKnots(LKnots);
l1 = BV1; l2 = BV2;
}else{
S.LKnots(LKnots);
l1 = S.FirstParameter(); l2 = S.LastParameter();
}
ErrorL = 0.0;
kLEnd = 1; JL = 0;
//OCC503(apo): if(Abs(l2-l1) < EPS_PARAM) continue;
if(Abs(l2-l1) > EPS_PARAM) {
iLSubEnd = LFillIntervalBounds(l1, l2, LKnots, NumSubs);
LMaxSubs = MaxSubs(iLSubEnd);
//-- exception avoiding
if(LMaxSubs > SM) LMaxSubs = SM;
DimL.Init(0.0,1,LMaxSubs); ErrL.Init(0.0,1,LMaxSubs); ErrUL.Init(0.0,1,LMaxSubs);
do{// while: L
if(++JL > iLSubEnd){
LRange[0] = IL = ErrL->Max(); LRange[1] = JL;
L1(JL) = (L1(IL) + L2(IL))/2.0; L2(JL) = L2(IL); L2(IL) = L1(JL);
}else LRange[0] = IL = JL;
if(JL == LMaxSubs || Abs(L2(JL) - L1(JL)) < EPS_PARAM)
if(kLEnd == 1){
DimL(JL) = ErrL(JL) = IxL(JL) = IyL(JL) = IzL(JL) =
IxxL(JL) = IyyL(JL) = IzzL(JL) = IxyL(JL) = IxzL(JL) = IyzL(JL) = 0.0;
}else{
JL--;
EpsL = ErrorL; Eps = EpsL/0.9;
break;
}
else
for(kL=0; kL < kLEnd; kL++){
iLS = LRange[kL];
lm = 0.5*(L2(iLS) + L1(iLS));
lr = 0.5*(L2(iLS) - L1(iLS));
CIx = CIy = CIz = CIxy = CIxz = CIyz = 0.0;
for(iGL=0; iGL < iGLEnd; iGL++){//
CDim[iGL] = CIxx[iGL] = CIyy[iGL] = CIzz[iGL] = 0.0;
for(iL=1; iL<=NbLGaussP[iGL]; iL++){
l = lm + lr*(*LGaussP[iGL])(iL);
if(isNaturalRestriction){
v = l; u2 = BU2; Dul = (*LGaussW[iGL])(iL);
}else{
S.D12d (l, Puv, Vuv);
Dul = Vuv.Y()*(*LGaussW[iGL])(iL); // Dul = Du / Dl
if(Abs(Dul) < EPS_PARAM) continue;
v = Puv.Y(); u2 = Puv.X();
//Check on cause out off bounds of value current parameter
if(v < BV1) v = BV1; else if(v > BV2) v = BV2;
if(u2 < BU1) u2 = BU1; else if(u2 > BU2) u2 = BU2;
}
ErrUL(iLS) = 0.0;
kUEnd = 1; JU = 0;
if(Abs(u2-u1) < EPS_PARAM) continue;
iUSubEnd = UFillIntervalBounds(u1, u2, UKnots, NumSubs);
UMaxSubs = MaxSubs(iUSubEnd);
//-- exception avoiding
if(UMaxSubs > SM) UMaxSubs = SM;
DimU.Init(0.0,1,UMaxSubs); ErrU.Init(0.0,1,UMaxSubs); ErrorU = 0.0;
do{//while: U
if(++JU > iUSubEnd){
URange[0] = IU = ErrU->Max(); URange[1] = JU;
U1(JU) = (U1(IU)+U2(IU))/2.0; U2(JU) = U2(IU); U2(IU) = U1(JU);
}else URange[0] = IU = JU;
if(JU == UMaxSubs || Abs(U2(JU) - U1(JU)) < EPS_PARAM)
if(kUEnd == 1){
DimU(JU) = ErrU(JU) = IxU(JU) = IyU(JU) = IzU(JU) =
IxxU(JU) = IyyU(JU) = IzzU(JU) = IxyU(JU) = IxzU(JU) = IyzU(JU) = 0.0;
}else{
JU--;
EpsU = ErrorU; Eps = EpsU*Abs((u2-u1)*Dul)/0.1; EpsL = 0.9*Eps;
break;
}
else
for(kU=0; kU < kUEnd; kU++){
iUS = URange[kU];
um = 0.5*(U2(iUS) + U1(iUS));
ur = 0.5*(U2(iUS) - U1(iUS));
iGUEnd = iGLEnd - iGL;
for(iGU=0; iGU < iGUEnd; iGU++){//
LocDim[iGU] =
LocIxx[iGU] = LocIyy[iGU] = LocIzz[iGU] =
LocIx[iGU] = LocIy[iGU] = LocIz[iGU] =
LocIxy[iGU] = LocIxz[iGU] = LocIyz[iGU] = 0.0;
for(iU=1; iU<=NbUGaussP[iGU]; iU++){
u = um + ur*(*UGaussP[iGU])(iU);
S.Normal(u, v, Ps, VNor);
VNor.Coord(xn, yn, zn);
Ps.Coord(x, y, z);
x -= xloc; y -= yloc; z -= zloc;
xn *= (*UGaussW[iGU])(iU);
yn *= (*UGaussW[iGU])(iU);
zn *= (*UGaussW[iGU])(iU);
if(ByPoint){
//volume of elementary cone
dDim = (x*xn+y*yn+z*zn)/3.0;
//coordinates of cone's center mass
px = 0.75*x; py = 0.75*y; pz = 0.75*z;
LocDim[iGU] += dDim;
//if(iGU > 0) continue;
LocIx[iGU] += px*dDim;
LocIy[iGU] += py*dDim;
LocIz[iGU] += pz*dDim;
x -= Coeff[0]; y -= Coeff[1]; z -= Coeff[2];
dDim *= 3.0/5.0;
LocIxy[iGU] -= x*y*dDim;
LocIyz[iGU] -= y*z*dDim;
LocIxz[iGU] -= x*z*dDim;
xi = x*x; yi = y*y; zi = z*z;
LocIxx[iGU] += (yi+zi)*dDim;
LocIyy[iGU] += (xi+zi)*dDim;
LocIzz[iGU] += (xi+yi)*dDim;
}else{ // by plane
s = xn*Coeff[0] + yn*Coeff[1] + zn*Coeff[2];
d1 = Coeff[0]*x + Coeff[1]*y + Coeff[2]*z - Coeff[3];
d2 = d1*d1;
d3 = d1*d2/3.0;
ds = s*d1;
LocDim[iGU] += ds;
//if(iGU > 0) continue;
LocIx[iGU] += (x - Coeff[0]*d1/2.0) * ds;
LocIy[iGU] += (y - Coeff[1]*d1/2.0) * ds;
LocIz[iGU] += (z - Coeff[2]*d1/2.0) * ds;
px = x-Coeff[0]*d1; py = y-Coeff[1]*d1; pz = z-Coeff[2]*d1;
xi = px*px*d1 + px*Coeff[0]*d2 + Coeff[0]*Coeff[0]*d3;
yi = py*py*d1 + py*Coeff[1]*d2 + Coeff[1]*Coeff[1]*d3;
zi = pz*pz*d1 + pz*Coeff[2]*d2 + Coeff[2]*Coeff[2]*d3;
LocIxx[iGU] += (yi+zi)*s;
LocIyy[iGU] += (xi+zi)*s;
LocIzz[iGU] += (xi+yi)*s;
d2 /= 2.0;
xi = py*pz*d1 + py*Coeff[2]*d2 + pz*Coeff[1]*d2 + Coeff[1]*Coeff[2]*d3;
yi = px*pz*d1 + pz*Coeff[0]*d2 + px*Coeff[2]*d2 + Coeff[0]*Coeff[2]*d3;
zi = px*py*d1 + px*Coeff[1]*d2 + py*Coeff[0]*d2 + Coeff[0]*Coeff[1]*d3;
LocIxy[iGU] -= zi*s; LocIyz[iGU] -= xi*s; LocIxz[iGU] -= yi*s;
}
}//for: iU
}//for: iGU
DimU(iUS) = LocDim[0]*ur;
IxxU(iUS) = LocIxx[0]*ur; IyyU(iUS) = LocIyy[0]*ur; IzzU(iUS) = LocIzz[0]*ur;
if(iGL > 0) continue;
LocDim[1] = Abs(LocDim[1]-LocDim[0]);
LocIxx[1] = Abs(LocIxx[1]-LocIxx[0]);
LocIyy[1] = Abs(LocIyy[1]-LocIyy[0]);
LocIzz[1] = Abs(LocIzz[1]-LocIzz[0]);
ErrU(iUS) = isMinDim? LocDim[1]*ur: (LocIxx[1] + LocIyy[1] + LocIzz[1])*ur;
IxU(iUS) = LocIx[0]*ur; IyU(iUS) = LocIy[0]*ur; IzU(iUS) = LocIz[0]*ur;
IxyU(iUS) = LocIxy[0]*ur; IxzU(iUS) = LocIxz[0]*ur; IyzU(iUS) = LocIyz[0]*ur;
}//for: kU (iUS)
if(JU == iUSubEnd) kUEnd = 2;
if(kUEnd == 2) {
Standard_Integer imax = ErrU->Max();
if(imax > 0) ErrorU = ErrU(imax);
else ErrorU = 0.0;
}
}while((ErrorU - EpsU > 0.0 && EpsU != 0.0) || kUEnd == 1);
for(i=1; i<=JU; i++) {
CDim[iGL] += DimU(i)*Dul;
CIxx[iGL] += IxxU(i)*Dul; CIyy[iGL] += IyyU(i)*Dul; CIzz[iGL] += IzzU(i)*Dul;
}
if(iGL > 0) continue;
ErrUL(iLS) = ErrorU*Abs((u2-u1)*Dul);
for(i=1; i<=JU; i++){
CIx += IxU(i)*Dul; CIy += IyU(i)*Dul; CIz += IzU(i)*Dul;
//CIxx += IxxU(i)*Dul; CIyy += IyyU(i)*Dul; CIzz += IzzU(i)*Dul;
CIxy += IxyU(i)*Dul; CIxz += IxzU(i)*Dul; CIyz += IyzU(i)*Dul;
}
}//for: iL
}//for: iGL
DimL(iLS) = CDim[0]*lr;
IxxL(iLS) = CIxx[0]*lr; IyyL(iLS) = CIyy[0]*lr; IzzL(iLS) = CIzz[0]*lr;
if(iGLEnd == 2) {
//ErrL(iLS) = Abs(CDim[1]-CDim[0])*lr + ErrUL(iLS);
CDim[1] = Abs(CDim[1]-CDim[0]);
CIxx[1] = Abs(CIxx[1]-CIxx[0]); CIyy[1] = Abs(CIyy[1]-CIyy[0]); CIzz[1] = Abs(CIzz[1]-CIzz[0]);
ErrorU = ErrUL(iLS);
ErrL(iLS) = (isMinDim? CDim[1]: (CIxx[1] + CIyy[1] + CIzz[1]))*lr + ErrorU;
}
IxL(iLS) = CIx*lr; IyL(iLS) = CIy*lr; IzL(iLS) = CIz*lr;
//IxxL(iLS) = CIxx*lr; IyyL(iLS) = CIyy*lr; IzzL(iLS) = CIzz*lr;
IxyL(iLS) = CIxy*lr; IxzL(iLS) = CIxz*lr; IyzL(iLS) = CIyz*lr;
}//for: (kL)iLS
// Calculate/correct epsilon of computation by current value of Dim
//That is need for not spend time for
if(JL == iLSubEnd){
kLEnd = 2;
Standard_Real DDim = 0.0, DIxx = 0.0, DIyy = 0.0, DIzz = 0.0;
for(i=1; i<=JL; i++) {
DDim += DimL(i);
DIxx += IxxL(i); DIyy += IyyL(i); DIzz += IzzL(i);
}
DDim = isMinDim? Abs(DDim): Abs(DIxx) + Abs(DIyy) + Abs(DIzz);
DDim = Abs(DDim*EpsDim);
if(DDim > Eps) {
Eps = DDim; EpsL = 0.9*Eps;
}
}
if(kLEnd == 2) {
Standard_Integer imax = ErrL->Max();
if(imax > 0) ErrorL = ErrL(imax);
else ErrorL = 0.0;
}
}while((ErrorL - EpsL > 0.0 && isVerifyComputation) || kLEnd == 1);
for(i=1; i<=JL; i++){
Dim += DimL(i);
Ix += IxL(i); Iy += IyL(i); Iz += IzL(i);
Ixx += IxxL(i); Iyy += IyyL(i); Izz += IzzL(i);
Ixy += IxyL(i); Ixz += IxzL(i); Iyz += IyzL(i);
}
ErrorLMax = Max(ErrorLMax, ErrorL);
}
if(isNaturalRestriction) break;
D.Next();
}
if(Abs(Dim) >= EPS_DIM){
if(ByPoint){
Ix = Coeff[0] + Ix/Dim;
Iy = Coeff[1] + Iy/Dim;
Iz = Coeff[2] + Iz/Dim;
}else{
Ix /= Dim;
Iy /= Dim;
Iz /= Dim;
}
g.SetCoord (Ix, Iy, Iz);
}else{
Dim =0.;
g.SetCoord(0.,0.,0.);
}
inertia.SetCols (gp_XYZ (Ixx, Ixy, Ixz),
gp_XYZ (Ixy, Iyy, Iyz),
gp_XYZ (Ixz, Iyz, Izz));
if(iGLEnd == 2)
Eps = Dim != 0.0? ErrorLMax/(isMinDim? Abs(Dim): (Abs(Ixx) + Abs(Iyy) + Abs(Izz))): 0.0;
else Eps = EpsDim;
return Eps;
}
static Standard_Real Compute(BRepGProp_Face& S, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia, Standard_Real EpsDim)
{
Standard_Boolean isErrorCalculation = 0.0 > EpsDim || EpsDim < 0.001? 1: 0;
Standard_Boolean isVerifyComputation = 0.0 < EpsDim && EpsDim < 0.001? 1: 0;
EpsDim = Abs(EpsDim);
BRepGProp_Domain D;
return CCompute(S,D,ByPoint,Coeff,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
}
static Standard_Real Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia, Standard_Real EpsDim)
{
Standard_Boolean isErrorCalculation = 0.0 > EpsDim || EpsDim < 0.001? 1: 0;
Standard_Boolean isVerifyComputation = 0.0 < EpsDim && EpsDim < 0.001? 1: 0;
EpsDim = Abs(EpsDim);
return CCompute(S,D,ByPoint,Coeff,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
}
static void Compute(const BRepGProp_Face& S,
const Standard_Boolean ByPoint,
const Standard_Real Coeff[],
const gp_Pnt& Loc,
Standard_Real& Volu,
gp_Pnt& G,
gp_Mat& Inertia)
{
gp_Pnt P;
gp_Vec VNor;
Standard_Real dvi, dv;
Standard_Real ur, um, u, vr, vm, v;
Standard_Real x, y, z, xn, yn, zn, xi, yi, zi;
// Standard_Real x, y, z, xn, yn, zn, xi, yi, zi, xyz;
Standard_Real px,py,pz,s,d1,d2,d3;
Standard_Real Ixi, Iyi, Izi, Ixxi, Iyyi, Izzi, Ixyi, Ixzi, Iyzi;
Standard_Real xloc, yloc, zloc;
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
Volu = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
Loc.Coord (xloc, yloc, zloc);
Standard_Real LowerU, UpperU, LowerV, UpperV;
S.Bounds ( LowerU, UpperU, LowerV, UpperV);
Standard_Integer UOrder = Min(S.UIntegrationOrder (),
math::GaussPointsMax());
Standard_Integer VOrder = Min(S.VIntegrationOrder (),
math::GaussPointsMax());
Standard_Integer i, j;
math_Vector GaussPU (1, UOrder); //gauss points and weights
math_Vector GaussWU (1, UOrder);
math_Vector GaussPV (1, VOrder);
math_Vector GaussWV (1, VOrder);
math::GaussPoints (UOrder,GaussPU);
math::GaussWeights (UOrder,GaussWU);
math::GaussPoints (VOrder,GaussPV);
math::GaussWeights (VOrder,GaussWV);
um = 0.5 * (UpperU + LowerU);
vm = 0.5 * (UpperV + LowerV);
ur = 0.5 * (UpperU - LowerU);
vr = 0.5 * (UpperV - LowerV);
for (j = 1; j <= VOrder; j++) {
v = vm + vr * GaussPV (j);
dvi = Ixi = Iyi = Izi = Ixxi = Iyyi = Izzi = Ixyi = Ixzi = Iyzi = 0.0;
for (i = 1; i <= UOrder; i++) {
u = um + ur * GaussPU (i);
S.Normal (u, v, P, VNor);
VNor.Coord (xn, yn, zn);
P.Coord (x, y, z);
x -= xloc; y -= yloc; z -= zloc;
xn *= GaussWU (i); yn *= GaussWU (i); zn *= GaussWU (i);
if (ByPoint) {
///////////////////// ///////////////////////
// OFV code // // Initial code //
///////////////////// ///////////////////////
// modified by APO
dv = (x*xn+y*yn+z*zn)/3.0; //xyz = x * y * z;
dvi += dv; //Ixyi += zn * xyz;
Ixi += 0.75*x*dv; //Iyzi += xn * xyz;
Iyi += 0.75*y*dv; //Ixzi += yn * xyz;
Izi += 0.75*z*dv; //xi = x * x * x * xn / 3.0;
x -= Coeff[0]; //yi = y * y * y * yn / 3.0;
y -= Coeff[1]; //zi = z * z * z * zn / 3.0;
z -= Coeff[2]; //Ixxi += (yi + zi);
dv *= 3.0/5.0; //Iyyi += (xi + zi);
Ixyi -= x*y*dv; //Izzi += (xi + yi);
Iyzi -= y*z*dv; //x -= Coeff[0];
Ixzi -= x*z*dv; //y -= Coeff[1];
xi = x*x; //z -= Coeff[2];
yi = y*y; //dv = x * xn + y * yn + z * zn;
zi = z*z; //dvi += dv;
Ixxi += (yi + zi)*dv; //Ixi += x * dv;
Iyyi += (xi + zi)*dv; //Iyi += y * dv;
Izzi += (xi + yi)*dv; //Izi += z * dv;
}
else { // by plane
s = xn * Coeff[0] + yn * Coeff[1] + zn * Coeff[2];
d1 = Coeff[0] * x + Coeff[1] * y + Coeff[2] * z - Coeff[3];
d2 = d1 * d1;
d3 = d1 * d2 / 3.0;
dv = s * d1;
dvi += dv;
Ixi += (x - (Coeff[0] * d1 / 2.0)) * dv;
Iyi += (y - (Coeff[1] * d1 / 2.0)) * dv;
Izi += (z - (Coeff[2] * d1 / 2.0)) * dv;
px = x - Coeff[0] * d1;
py = y - Coeff[1] * d1;
pz = z - Coeff[2] * d1;
xi = px * px * d1 + px * Coeff[0]* d2 + Coeff[0] * Coeff[0] * d3;
yi = py * py * d1 + py * Coeff[1] * d2 + Coeff[1] * Coeff[1] * d3;
zi = pz * pz * d1 + pz * Coeff[2] * d2 + Coeff[2] * Coeff[2] * d3;
Ixxi += (yi + zi) * s;
Iyyi += (xi + zi) * s;
Izzi += (xi + yi) * s;
d2 /= 2.0;
xi = (py * pz * d1) + (py * Coeff[2] * d2) + (pz * Coeff[1] * d2) + (Coeff[1] * Coeff[2] * d3);
yi = (px * pz * d1) + (pz * Coeff[0] * d2) + (px * Coeff[2] * d2) + (Coeff[0] * Coeff[2] * d3);
zi = (px * py * d1) + (px * Coeff[1] * d2) + (py * Coeff[0] * d2) + (Coeff[0] * Coeff[1] * d3);
Ixyi -= zi * s;
Iyzi -= xi * s;
Ixzi -= yi * s;
}
}
Volu += dvi * GaussWV (j);
Ix += Ixi * GaussWV (j);
Iy += Iyi * GaussWV (j);
Iz += Izi * GaussWV (j);
Ixx += Ixxi * GaussWV (j);
Iyy += Iyyi * GaussWV (j);
Izz += Izzi * GaussWV (j);
Ixy += Ixyi * GaussWV (j);
Ixz += Ixzi * GaussWV (j);
Iyz += Iyzi * GaussWV (j);
}
vr *= ur;
Ixx *= vr;
Iyy *= vr;
Izz *= vr;
Ixy *= vr;
Ixz *= vr;
Iyz *= vr;
if (Abs(Volu) >= EPS_DIM ) {
if (ByPoint) {
Ix = Coeff[0] + Ix/Volu;
Iy = Coeff[1] + Iy/Volu;
Iz = Coeff[2] + Iz/Volu;
Volu *= vr;
}
else { //by plane
Ix /= Volu;
Iy /= Volu;
Iz /= Volu;
Volu *= vr;
}
G.SetCoord (Ix, Iy, Iz);
}
else {
G.SetCoord(0.,0.,0.);
Volu =0.;
}
Inertia.SetCols (gp_XYZ (Ixx, Ixy, Ixz),
gp_XYZ (Ixy, Iyy, Iyz),
gp_XYZ (Ixz, Iyz, Izz));
}
// Last modified by OFV 5.2001:
// 1). surface and edge integration order is equal now
// 2). "by point" works now rathre correctly (it looks so...)
static void Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& Loc, Standard_Real& Volu, gp_Pnt& G, gp_Mat& Inertia)
{
Standard_Real x, y, z, xi, yi, zi, l1, l2, lm, lr, l, v1, v2, v, u1, u2, um, ur, u, ds, Dul, xloc, yloc, zloc;
Standard_Real LocVolu, LocIx, LocIy, LocIz, LocIxx, LocIyy, LocIzz, LocIxy, LocIxz, LocIyz;
Standard_Real CVolu, CIx, CIy, CIz, CIxx, CIyy, CIzz, CIxy, CIxz, CIyz, Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
Standard_Real xn, yn, zn, px, py, pz, s, d1, d2, d3, dSigma;
Standard_Integer i, j, vio, sio, max, NbGaussgp_Pnts;
gp_Pnt Ps;
gp_Vec VNor;
gp_Pnt2d Puv;
gp_Vec2d Vuv;
Loc.Coord (xloc, yloc, zloc);
Volu = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
S.Bounds (u1, u2, v1, v2);
Standard_Real _u2 = u2; //OCC104
vio = S.VIntegrationOrder ();
while (D.More())
{
S.Load(D.Value());
sio = S.IntegrationOrder ();
max = Max(vio,sio);
NbGaussgp_Pnts = Min(max,math::GaussPointsMax());
math_Vector GaussP (1, NbGaussgp_Pnts);
math_Vector GaussW (1, NbGaussgp_Pnts);
math::GaussPoints (NbGaussgp_Pnts,GaussP);
math::GaussWeights (NbGaussgp_Pnts,GaussW);
CVolu = CIx = CIy = CIz = CIxx = CIyy = CIzz = CIxy = CIxz = CIyz = 0.0;
l1 = S.FirstParameter();
l2 = S.LastParameter();
lm = 0.5 * (l2 + l1);
lr = 0.5 * (l2 - l1);
for (i=1; i<=NbGaussgp_Pnts; i++)
{
l = lm + lr * GaussP(i);
S.D12d (l, Puv, Vuv);
v = Puv.Y();
u2 = Puv.X();
//OCC104
v = v < v1? v1: v;
v = v > v2? v2: v;
u2 = u2 < u1? u1: u2;
u2 = u2 > _u2? _u2: u2;
Dul = Vuv.Y() * GaussW(i);
um = 0.5 * (u2 + u1);
ur = 0.5 * (u2 - u1);
LocVolu = LocIx = LocIy = LocIz = LocIxx = LocIyy = LocIzz = LocIxy = LocIxz = LocIyz = 0.0;
for (j=1; j<=NbGaussgp_Pnts; j++)
{
u = um + ur * GaussP(j);
S.Normal (u, v, Ps, VNor);
VNor.Coord (xn, yn, zn);
Ps.Coord (x, y, z);
x -= xloc;
y -= yloc;
z -= zloc;
xn = xn * Dul * GaussW(j);
yn = yn * Dul * GaussW(j);
zn = zn * Dul * GaussW(j);
if(ByPoint)
{
dSigma = (x*xn+y*yn+z*zn)/3.0;
LocVolu += dSigma;
LocIx += 0.75*x*dSigma;
LocIy += 0.75*y*dSigma;
LocIz += 0.75*z*dSigma;
x -= Coeff[0];
y -= Coeff[1];
z -= Coeff[2];
dSigma *= 3.0/5.0;
LocIxy -= x*y*dSigma;
LocIyz -= y*z*dSigma;
LocIxz -= x*z*dSigma;
xi = x*x;
yi = y*y;
zi = z*z;
LocIxx += (yi + zi)*dSigma;
LocIyy += (xi + zi)*dSigma;
LocIzz += (xi + yi)*dSigma;
}
else
{
s = xn * Coeff[0] + yn * Coeff[1] + zn * Coeff[2];
d1 = Coeff[0] * x + Coeff[1] * y + Coeff[2] * z;
d2 = d1 * d1;
d3 = d1 * d2 / 3.0;
ds = s * d1;
LocVolu += ds;
LocIx += (x - Coeff[0] * d1 / 2.0) * ds;
LocIy += (y - Coeff[1] * d1 / 2.0) * ds;
LocIz += (z - Coeff[2] * d1 / 2.0) * ds;
px = x - Coeff[0] * d1;
py = y - Coeff[1] * d1;
pz = z - Coeff[2] * d1;
xi = (px * px * d1) + (px * Coeff[0]* d2) + (Coeff[0] * Coeff[0] * d3);
yi = (py * py * d1) + (py * Coeff[1] * d2) + (Coeff[1] * Coeff[1] * d3);
zi = pz * pz * d1 + pz * Coeff[2] * d2 + (Coeff[2] * Coeff[2] * d3);
LocIxx += (yi + zi) * s;
LocIyy += (xi + zi) * s;
LocIzz += (xi + yi) * s;
d2 /= 2.0;
xi = (py * pz * d1) + (py * Coeff[2] * d2) + (pz * Coeff[1] * d2) + (Coeff[1] * Coeff[2] * d3);
yi = (px * pz * d1) + (pz * Coeff[0] * d2) + (px * Coeff[2] * d2) + (Coeff[0] * Coeff[2] * d3);
zi = (px * py * d1) + (px * Coeff[1] * d2) + (py * Coeff[0] * d2) + (Coeff[0] * Coeff[1] * d3);
LocIxy -= zi * s;
LocIyz -= xi * s;
LocIxz -= yi * s;
}
}
CVolu += LocVolu * ur;
CIx += LocIx * ur;
CIy += LocIy * ur;
CIz += LocIz * ur;
CIxx += LocIxx * ur;
CIyy += LocIyy * ur;
CIzz += LocIzz * ur;
CIxy += LocIxy * ur;
CIxz += LocIxz * ur;
CIyz += LocIyz * ur;
}
Volu += CVolu * lr;
Ix += CIx * lr;
Iy += CIy * lr;
Iz += CIz * lr;
Ixx += CIxx * lr;
Iyy += CIyy * lr;
Izz += CIzz * lr;
Ixy += CIxy * lr;
Ixz += CIxz * lr;
Iyz += CIyz * lr;
D.Next();
}
if(Abs(Volu) >= EPS_DIM)
{
if(ByPoint)
{
Ix = Coeff[0] + Ix/Volu;
Iy = Coeff[1] + Iy/Volu;
Iz = Coeff[2] + Iz/Volu;
}
else
{
Ix /= Volu;
Iy /= Volu;
Iz /= Volu;
}
G.SetCoord (Ix, Iy, Iz);
}
else
{
Volu =0.;
G.SetCoord(0.,0.,0.);
}
Inertia.SetCols (gp_XYZ (Ixx, Ixy, Ixz),
gp_XYZ (Ixy, Iyy, Iyz),
gp_XYZ (Ixz, Iyz, Izz));
}
BRepGProp_Vinert::BRepGProp_Vinert(){}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,Eps);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,D,Eps);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,D);
}
BRepGProp_Vinert::BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, const gp_Pnt& O, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,O,Eps);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& O, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,D,O,Eps);
}
BRepGProp_Vinert::BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pnt& O, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,O);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& O, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,D,O);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, const gp_Pln& Pl, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,Pl,Eps);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pln& Pl, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,D,Pl,Eps);
}
BRepGProp_Vinert::BRepGProp_Vinert(const BRepGProp_Face& S, const gp_Pln& Pl, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,Pl);
}
BRepGProp_Vinert::BRepGProp_Vinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pln& Pl, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,D,Pl);
}
void BRepGProp_Vinert::SetLocation(const gp_Pnt& VLocation){
loc = VLocation;
}
Standard_Real BRepGProp_Vinert::Perform(BRepGProp_Face& S, const Standard_Real Eps){
Standard_Real Coeff[] = {0., 0., 0.};
return myEpsilon = Compute(S,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
Standard_Real BRepGProp_Vinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const Standard_Real Eps){
Standard_Real Coeff[] = {0., 0., 0.};
return myEpsilon = Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
void BRepGProp_Vinert::Perform(const BRepGProp_Face& S){
Standard_Real Coeff[] = {0., 0., 0.};
Compute(S,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void BRepGProp_Vinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D){
Standard_Real Coeff[] = {0., 0., 0.};
Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real BRepGProp_Vinert::Perform(BRepGProp_Face& S, const gp_Pnt& O, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
return myEpsilon = Compute(S,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
Standard_Real BRepGProp_Vinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& O, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
return myEpsilon = Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
void BRepGProp_Vinert::Perform(const BRepGProp_Face& S, const gp_Pnt& O){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
Compute(S,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void BRepGProp_Vinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& O){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real BRepGProp_Vinert::Perform(BRepGProp_Face& S, const gp_Pln& Pl, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
return myEpsilon = Compute(S,Standard_False,Coeff,loc,dim,g,inertia,Eps);
}
Standard_Real BRepGProp_Vinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pln& Pl, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
return myEpsilon = Compute(S,D,Standard_False,Coeff,loc,dim,g,inertia,Eps);
}
void BRepGProp_Vinert::Perform(const BRepGProp_Face& S, const gp_Pln& Pl){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
Compute(S,Standard_False,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void BRepGProp_Vinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pln& Pl){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
Compute(S,D,Standard_False,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real BRepGProp_Vinert::GetEpsilon(){
return myEpsilon;
}

View File

@@ -1,244 +0,0 @@
-- Created on: 2005-12-21
-- Created by: Sergey KHROMOV
-- Copyright (c) 2005-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class VinertGK from BRepGProp inherits GProps from GProp
---Purpose: Computes the global properties of a geometric solid
-- (3D closed region of space) delimited with :
-- - a point and a surface
-- - a plane and a surface
--
-- The surface can be :
-- - a surface limited with its parametric values U-V,
-- (naturally restricted)
-- - a surface limited in U-V space with its boundary
-- curves.
--
-- The surface's requirements to evaluate the global
-- properties are defined in the template FaceTool class from
-- the package GProp.
--
-- The adaptive 2D algorithm of Gauss-Kronrod integration of
-- double integral is used.
--
-- The inner integral is computed along U parameter of
-- surface. The integrand function is encapsulated in the
-- support class UFunction that is defined below.
--
-- The outer integral is computed along T parameter of a
-- bounding curve. The integrand function is encapsulated in
-- the support class TFunction that is defined below.
uses
Pnt from gp,
XYZ from gp,
Pln from gp,
Address from Standard,
Boolean from Standard,
Real from Standard,
Edge from TopoDS,
Face from BRepGProp,
Domain from BRepGProp
-- Template class functions. Used for integration. Begin
is
Create
---Purpose: Empty constructor.
---C++: inline
returns VinertGK;
Create(theSurface : in out Face from BRepGProp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the naturally restricted surface
-- and the point VLocation.
returns VinertGK;
Create(theSurface : in out Face from BRepGProp;
thePoint : Pnt from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the naturally restricted surface
-- and the point VLocation. The inertia is computed with
-- respect to thePoint.
returns VinertGK;
Create(theSurface : in out Face from BRepGProp;
theDomain : in out Domain from BRepGProp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the surface bounded by the domain
-- and the point VLocation.
returns VinertGK;
Create(theSurface : in out Face from BRepGProp;
theDomain : in out Domain from BRepGProp;
thePoint : Pnt from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the surface bounded by the domain
-- and the point VLocation. The inertia is computed with
-- respect to thePoint.
returns VinertGK;
Create(theSurface : in out Face from BRepGProp;
thePlane : Pln from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the naturally restricted surface
-- and the plane.
returns VinertGK;
Create(theSurface : in out Face from BRepGProp;
theDomain : in out Domain from BRepGProp;
thePlane : Pln from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the surface bounded by the domain
-- and the plane.
returns VinertGK;
SetLocation(me: in out; theLocation: Pnt from gp);
---Purpose: Sets the vertex that delimit 3D closed region of space.
---C++: inline
Perform(me: in out; theSurface : in out Face from BRepGProp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the naturally restricted surface and the
-- point VLocation.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face from BRepGProp;
thePoint : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the naturally restricted surface and the
-- point VLocation. The inertia is computed with respect to
-- thePoint.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face from BRepGProp;
theDomain : in out Domain from BRepGProp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the surface bounded by the domain and the
-- point VLocation.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face from BRepGProp;
theDomain : in out Domain from BRepGProp;
thePoint : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the surface bounded by the domain and the
-- point VLocation. The inertia is computed with respect to
-- thePoint.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face from BRepGProp;
thePlane : Pln from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the naturally restricted surface and the
-- plane.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face from BRepGProp;
theDomain : in out Domain from BRepGProp;
thePlane : Pln from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the surface bounded by the domain and the
-- plane.
returns Real from Standard;
GetErrorReached(me)
---Purpose: Returns the relative reached computation error.
---C++: inline
returns Real from Standard;
GetAbsolutError(me)
---Purpose: Returns the absolut reached computation error.
---C++: inline
returns Real from Standard;
-----------------------
-- Private methods --
-----------------------
PrivatePerform(me: in out;
theSurface : in out Face from BRepGProp;
thePtrDomain: Address from Standard; -- pointer to Domain from BRepGProp.
IsByPoint : Boolean from Standard;
theCoeffs : Address from Standard;
theTolerance: Real from Standard;
theCGFlag : Boolean from Standard;
theIFlag : Boolean from Standard)
---Purpose: Main method for computation of the global properties that
-- is invoked by each Perform method.
returns Real from Standard
is private;
fields
myErrorReached: Real from Standard;
myAbsolutError: Real from Standard;
end VinertGK;

File diff suppressed because it is too large Load Diff

View File

@@ -76,6 +76,12 @@
# include <strings.h>
#endif
//Number of BRepCheck_Statuses in BRepCheck_Status.hxx file
//(BRepCheck_NoError is not considered, i.e. general status
//is smaller by one specified in file)
static const Standard_Integer NumberOfStatus = 35;
static char* checkfaultyname = NULL;
Standard_EXPORT void BRepTest_CheckCommands_SetFaultyName(const char* name)
{
@@ -511,40 +517,46 @@ static void FillProblems(const BRepCheck_Status stat,
NbProblems->SetValue(14,NbProblems->Value(14)+1); break;
case BRepCheck_InvalidRange:
NbProblems->SetValue(15,NbProblems->Value(15)+1); break;
case BRepCheck_EmptyWire:
case BRepCheck_PCurveIsOutOfDomainFace:
NbProblems->SetValue(16,NbProblems->Value(16)+1); break;
case BRepCheck_RedundantEdge:
case BRepCheck_EmptyWire:
NbProblems->SetValue(17,NbProblems->Value(17)+1); break;
case BRepCheck_SelfIntersectingWire:
case BRepCheck_RedundantEdge:
NbProblems->SetValue(18,NbProblems->Value(18)+1); break;
case BRepCheck_NoSurface:
case BRepCheck_SelfIntersectingWire:
NbProblems->SetValue(19,NbProblems->Value(19)+1); break;
case BRepCheck_InvalidWire:
case BRepCheck_NoSurface:
NbProblems->SetValue(20,NbProblems->Value(20)+1); break;
case BRepCheck_RedundantWire:
case BRepCheck_OutOfSurfaceBoundary:
NbProblems->SetValue(21,NbProblems->Value(21)+1); break;
case BRepCheck_IntersectingWires:
case BRepCheck_InvalidWire:
NbProblems->SetValue(22,NbProblems->Value(22)+1); break;
case BRepCheck_InvalidImbricationOfWires:
case BRepCheck_RedundantWire:
NbProblems->SetValue(23,NbProblems->Value(23)+1); break;
case BRepCheck_EmptyShell:
case BRepCheck_IntersectingWires:
NbProblems->SetValue(24,NbProblems->Value(24)+1); break;
case BRepCheck_RedundantFace:
case BRepCheck_InvalidImbricationOfWires:
NbProblems->SetValue(25,NbProblems->Value(25)+1); break;
case BRepCheck_UnorientableShape:
case BRepCheck_EmptyShell:
NbProblems->SetValue(26,NbProblems->Value(26)+1); break;
case BRepCheck_NotClosed:
case BRepCheck_RedundantFace:
NbProblems->SetValue(27,NbProblems->Value(27)+1); break;
case BRepCheck_NotConnected:
case BRepCheck_UnorientableShape:
NbProblems->SetValue(28,NbProblems->Value(28)+1); break;
case BRepCheck_SubshapeNotInShape:
case BRepCheck_NotClosed:
NbProblems->SetValue(29,NbProblems->Value(29)+1); break;
case BRepCheck_BadOrientation:
case BRepCheck_NotConnected:
NbProblems->SetValue(30,NbProblems->Value(30)+1); break;
case BRepCheck_BadOrientationOfSubshape:
case BRepCheck_SubshapeNotInShape:
NbProblems->SetValue(31,NbProblems->Value(31)+1); break;
case BRepCheck_CheckFail:
case BRepCheck_BadOrientation:
NbProblems->SetValue(32,NbProblems->Value(32)+1); break;
case BRepCheck_BadOrientationOfSubshape:
NbProblems->SetValue(33,NbProblems->Value(33)+1); break;
case BRepCheck_InvalidToleranceValue:
NbProblems->SetValue(34,NbProblems->Value(34)+1); break;
case BRepCheck_CheckFail:
NbProblems->SetValue(35,NbProblems->Value(35)+1); break;
default:
break;
}
@@ -670,8 +682,9 @@ void StructuralDump(Draw_Interpretor& theCommands,
theCommands<<" Check Count"<<"\n";
theCommands<<" ------------------------------------------------"<<"\n";
Handle(TColStd_HArray1OfInteger) NbProblems = new TColStd_HArray1OfInteger(1,32);
for(i=1; i<=32; i++) NbProblems->SetValue(i,0);
Handle(TColStd_HArray1OfInteger) NbProblems = new
TColStd_HArray1OfInteger(1,NumberOfStatus);
for(i=1; i<=NumberOfStatus; i++) NbProblems->SetValue(i,0);
Handle(TopTools_HSequenceOfShape) sl,slv,sle,slw,slf,sls,slo;
sl = new TopTools_HSequenceOfShape();
theMap.Clear();
@@ -724,55 +737,64 @@ void StructuralDump(Draw_Interpretor& theCommands,
theCommands<<" Invalid Range ............................ "<<NbProblems->Value(15)<<"\n";
//cout<<" Invalid Range ............................ "<<NbProblems->Value(15)<<endl;
if(NbProblems->Value(16)>0)
theCommands<<" Empty Wire ............................... "<<NbProblems->Value(16)<<"\n";
//cout<<" Empty Wire ............................... "<<NbProblems->Value(16)<<endl;
theCommands<<" pcurve is out of domain face.............. "<<NbProblems->Value(16)<<"\n";
//cout<<" Invalid Range ............................ "<<NbProblems->Value(15)<<endl;
if(NbProblems->Value(17)>0)
theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<"\n";
//cout<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<endl;
theCommands<<" Empty Wire ............................... "<<NbProblems->Value(17)<<"\n";
//cout<<" Empty Wire ............................... "<<NbProblems->Value(16)<<endl;
if(NbProblems->Value(18)>0)
theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<"\n";
//cout<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<endl;
theCommands<<" Redundant Edge ........................... "<<NbProblems->Value(18)<<"\n";
//cout<<" Redundant Edge ........................... "<<NbProblems->Value(17)<<endl;
if(NbProblems->Value(19)>0)
theCommands<<" No Surface ............................... "<<NbProblems->Value(19)<<"\n";
//cout<<" No Surface ............................... "<<NbProblems->Value(19)<<endl;
theCommands<<" Self Intersecting Wire ................... "<<NbProblems->Value(19)<<"\n";
//cout<<" Self Intersecting Wire ................... "<<NbProblems->Value(18)<<endl;
if(NbProblems->Value(20)>0)
theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<"\n";
//cout<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<endl;
theCommands<<" No Surface ............................... "<<NbProblems->Value(20)<<"\n";
//cout<<" No Surface ............................... "<<NbProblems->Value(19)<<endl;
if(NbProblems->Value(21)>0)
theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<"\n";
//cout<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<endl;
theCommands<<" Face is out of it surface boundary........ "<<NbProblems->Value(21)<<"\n";
//cout<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<endl;
if(NbProblems->Value(22)>0)
theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<"\n";
//cout<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<endl;
theCommands<<" Invalid Wire ............................. "<<NbProblems->Value(22)<<"\n";
//cout<<" Invalid Wire ............................. "<<NbProblems->Value(20)<<endl;
if(NbProblems->Value(23)>0)
theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<"\n";
//cout<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<endl;
theCommands<<" Redundant Wire ........................... "<<NbProblems->Value(23)<<"\n";
//cout<<" Redundant Wire ........................... "<<NbProblems->Value(21)<<endl;
if(NbProblems->Value(24)>0)
theCommands<<" Empty Shell .............................. "<<NbProblems->Value(24)<<"\n";
//cout<<" Empty Shell .............................. "<<NbProblems->Value(24)<<endl;
theCommands<<" Intersecting Wires ....................... "<<NbProblems->Value(24)<<"\n";
//cout<<" Intersecting Wires ....................... "<<NbProblems->Value(22)<<endl;
if(NbProblems->Value(25)>0)
theCommands<<" Redundant Face ........................... "<<NbProblems->Value(25)<<"\n";
//cout<<" Redundant Face ........................... "<<NbProblems->Value(25)<<endl;
theCommands<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(25)<<"\n";
//cout<<" Invalid Imbrication of Wires ............. "<<NbProblems->Value(23)<<endl;
if(NbProblems->Value(26)>0)
theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<"\n";
//cout<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<endl;
theCommands<<" Empty Shell .............................. "<<NbProblems->Value(26)<<"\n";
//cout<<" Empty Shell .............................. "<<NbProblems->Value(24)<<endl;
if(NbProblems->Value(27)>0)
theCommands<<" Not Closed ............................... "<<NbProblems->Value(27)<<"\n";
//cout<<" Not Closed ............................... "<<NbProblems->Value(27)<<endl;
theCommands<<" Redundant Face ........................... "<<NbProblems->Value(27)<<"\n";
//cout<<" Redundant Face ........................... "<<NbProblems->Value(25)<<endl;
if(NbProblems->Value(28)>0)
theCommands<<" Not Connected ............................ "<<NbProblems->Value(28)<<"\n";
//cout<<" Not Connected ............................ "<<NbProblems->Value(28)<<endl;
theCommands<<" Unorientable Shape ....................... "<<NbProblems->Value(28)<<"\n";
//cout<<" Unorientable Shape ....................... "<<NbProblems->Value(26)<<endl;
if(NbProblems->Value(29)>0)
theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<"\n";
//cout<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<endl;
theCommands<<" Not Closed ............................... "<<NbProblems->Value(29)<<"\n";
//cout<<" Not Closed ............................... "<<NbProblems->Value(27)<<endl;
if(NbProblems->Value(30)>0)
theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<"\n";
//cout<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<endl;
theCommands<<" Not Connected ............................ "<<NbProblems->Value(30)<<"\n";
//cout<<" Not Connected ............................ "<<NbProblems->Value(28)<<endl;
if(NbProblems->Value(31)>0)
theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<"\n";
//cout<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<endl;
theCommands<<" Subshape not in Shape .................... "<<NbProblems->Value(31)<<"\n";
//cout<<" Subshape not in Shape .................... "<<NbProblems->Value(29)<<endl;
if(NbProblems->Value(32)>0)
theCommands<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<"\n";
theCommands<<" Bad Orientation .......................... "<<NbProblems->Value(32)<<"\n";
//cout<<" Bad Orientation .......................... "<<NbProblems->Value(30)<<endl;
if(NbProblems->Value(33)>0)
theCommands<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(33)<<"\n";
//cout<<" Bad Orientation of Subshape .............. "<<NbProblems->Value(31)<<endl;
if(NbProblems->Value(34)>0)
theCommands<<" Invalid tolerance......................... "<<NbProblems->Value(34)<<"\n";
//cout<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
if(NbProblems->Value(35)>0)
theCommands<<" checkshape failure........................ "<<NbProblems->Value(35)<<"\n";
//cout<<" checkshape failure......... .............. "<<NbProblems->Value(32)<<endl;
//cout<<" ------------------------------------------------"<<endl;

View File

@@ -57,7 +57,6 @@
#include <Draw_Appli.hxx>
#include <DrawTrSurf.hxx>
#include <DrawTrSurf_BSplineCurve2d.hxx>
#include <DrawTrSurf_Point.hxx>
#include <gp.hxx>
#include <Precision.hxx>
@@ -79,13 +78,12 @@ Standard_IMPORT Draw_Viewer dout;
static Standard_Integer vertex(Draw_Interpretor& , Standard_Integer n, const char** a)
{
if (n < 3) return 1;
if (n < 4) return 1;
if (n >= 5) {
DBRep::Set(a[1],
BRepBuilderAPI_MakeVertex(gp_Pnt(Draw::Atof(a[2]),Draw::Atof(a[3]),Draw::Atof(a[4]))));
}
else if (n == 4)
{
else {
TopoDS_Shape S = DBRep::Get(a[3]);
if (S.IsNull()) return 0;
if (S.ShapeType() != TopAbs_EDGE) return 0;
@@ -94,12 +92,6 @@ static Standard_Integer vertex(Draw_Interpretor& , Standard_Integer n, const cha
C.D0(Draw::Atof(a[2]),P);
DBRep::Set(a[1], BRepBuilderAPI_MakeVertex(P));
}
else
{
Handle(DrawTrSurf_Point) aP =
Handle(DrawTrSurf_Point)::DownCast(Draw::Get(a[2]));
DBRep::Set(a[1], BRepBuilderAPI_MakeVertex(aP->Point()));
}
return 0;
}
@@ -1780,7 +1772,7 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
const char* g = "TOPOLOGY Curve topology commands";
theCommands.Add("vertex",
"vertex name [x y z | p edge | poin]",__FILE__,
"vertex name [x y z / p edge]",__FILE__,
vertex,g);
theCommands.Add("etrim",

View File

@@ -282,10 +282,6 @@ void BVH_BinnedBuilder<T, N, Bins>::BuildNode (BVH_Set<T, N>* theSet,
|| theBVH->Level (aChildIndex) >= BVH_Builder<T, N>::myMaxTreeDepth;
if (!isLeaf)
{
BVH_Builder<T, N>::myTasksQueue.Append (aChildIndex);
}
BVH_Builder<T, N>::UpdateDepth (theBVH, theBVH->Level (aChildIndex));
}
}

View File

@@ -54,16 +54,6 @@ protected:
BVH_Tree<T, N>* theBVH,
const Standard_Integer theTask);
//! Updates depth of constructed BVH tree.
void UpdateDepth (BVH_Tree<T, N>* theBVH,
const Standard_Integer theLevel)
{
if (theLevel > theBVH->myDepth)
{
theBVH->myDepth = theLevel;
}
}
protected:
Standard_Integer myMaxTreeDepth; //!< Maximum depth of constructed BVH

View File

@@ -184,7 +184,5 @@ void BVH_SweepPlaneBuilder<T, N>::BuildNode (BVH_Set<T, N>* theSet,
{
BVH_Builder<T, N>::myTasksQueue.Append (aChildIndex);
}
BVH_Builder<T, N>::UpdateDepth (theBVH, theBVH->Level (aChildIndex));
}
}

View File

@@ -20,8 +20,6 @@
#include <BVH_Box.hxx>
template<class T, int N> class BVH_Builder;
//! Stores parameters of bounding volume hierarchy (BVH).
//! Bounding volume hierarchy (BVH) organizes geometric objects in
//! the tree based on spatial relationships. Each node in the tree
@@ -33,20 +31,12 @@ template<class T, int N> class BVH_Builder;
template<class T, int N>
class BVH_Tree
{
friend class BVH_Builder<T, N>;
public:
typedef typename BVH_Box<T, N>::BVH_VecNt BVH_VecNt;
public:
//! Creates new empty BVH tree.
BVH_Tree() : myDepth (0)
{
//
}
//! Returns minimum point of the given node.
BVH_VecNt& MinPoint (const Standard_Integer theNodeIndex)
{
@@ -161,12 +151,6 @@ public:
return BVHTools::ArrayOp<Standard_Integer, 4>::Size (myNodeInfoBuffer);
}
//! Returns depth of BVH tree from last build.
Standard_Integer Depth() const
{
return myDepth;
}
public:
//! Removes all BVH nodes.
@@ -248,9 +232,6 @@ protected:
//! Array of node data records.
BVH_Array4i myNodeInfoBuffer;
//! Depth of constructed tree.
Standard_Integer myDepth;
};
#include <BVH_Tree.lxx>

View File

@@ -20,8 +20,6 @@
template<class T, int N>
void BVH_Tree<T, N>::Clear()
{
myDepth = 0;
BVHTools::ArrayOp<T, N>::Clear (myMinPointBuffer);
BVHTools::ArrayOp<T, N>::Clear (myMaxPointBuffer);

View File

@@ -16,82 +16,72 @@
package Contap
---Purpose:
---Purpose:
uses Standard,StdFail,MMgt, GeomAbs, TopAbs, TCollection, gp, TColgp,
math, IntSurf, IntStart, IntWalk,
Geom2d, TColStd, Geom, Adaptor3d, Adaptor2d
is
generic class Point;
generic class Line;
class Point;
generic class SurfFunction;
generic class ArcFunction;
generic class SurfProps;
class Line;
generic class ContourGen, ThePoint,TheSequenceOfPoint,TheHSequenceOfPoint,
TheLine, TheSequenceOfLine,
TheSurfProps, TheSurfFunction, TheArcFunction,
TheSearch, TheIWalking, TheSearchInside;
---TheLineConstructor;
class SurfFunction;
class ArcFunction;
class SurfProps;
class Contour;
class TheSequenceOfPoint instantiates Sequence from TCollection (Point from Contap);
class TheHSequenceOfPoint instantiates HSequence from TCollection
(Point from Contap,
TheSequenceOfPoint from Contap);
class TheSequenceOfLine instantiates Sequence from TCollection(Line from Contap);
class TheSearch instantiates SearchOnBoundaries from IntStart
(HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HCurve2dTool from Contap,
HContTool from Contap,
TopolTool from Adaptor3d,
ArcFunction from Contap);
class TheIWalking instantiates IWalking from IntWalk
(PathPoint from IntSurf,
PathPointTool from IntSurf,
SequenceOfPathPoint from IntSurf,
InteriorPoint from IntSurf,
InteriorPointTool from IntSurf,
SequenceOfInteriorPoint from IntSurf,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d,
SurfFunction from Contap);
class TheSearchInside instantiates SearchInside from IntStart
(HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d,
TopolTool from Adaptor3d,
HContTool from Contap,
SurfFunction from Contap);
class ContAna;
class ContAna;
enumeration TFunction is
ContourStd,
ContourPrs,
DraftStd,
DraftPrs
end TFunction;
ContourStd,
ContourPrs,
DraftStd,
DraftPrs
end TFunction;
enumeration IType is -- a replacer dans IntSurf et fusionner avec IntPatch
-- type of the line of contour
Lin, -- pour conflit avec deferred class Line
Circle,
Walking,
Restriction
end IType;
class HContTool;
Lin, -- pour conflit avec deferred class Line
Circle,
Walking,
Restriction
end IType;
generic class HContToolGen;
class HCurve2dTool;
generic class HCurve2dToolGen;
class HCurve2dTool instantiates
HCurve2dToolGen from Contap (
HCurve2d from Adaptor2d);
class HContTool instantiates
HContToolGen from Contap (
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d);
class Contour instantiates ContourGen from Contap
(HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d,
HContTool from Contap,
TopolTool from Adaptor3d);
end Contap;

View File

@@ -14,21 +14,25 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ArcFunction from Contap inherits FunctionWithDerivative from math
generic class ArcFunction from Contap
(TheArc as any;
TheSurface as any;
TheArcTool as any;
TheSurfaceTool as any;
TheSurfProps as any; -- as SurfProps from Contap(TheSurface,
-- TheSurfaceTool)
TheContTool as any) -- as ContTool from Contap()
inherits FunctionWithDerivative from math
uses Pnt from gp,
Dir from gp,
SequenceOfPnt from TColgp,
TFunction from Contap,
--modified by NIZNHY-PKV Thu Mar 29 16:52:28 2001 f
Quadric from IntSurf,
--modified by NIZNHY-PKV Thu Mar 29 16:52:31 2001
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d,
SurfProps from Contap,
HContTool from Contap
Quadric from IntSurf
--modified by NIZNHY-PKV Thu Mar 29 16:52:31 2001 t
is
@@ -38,7 +42,7 @@ is
returns ArcFunction from Contap;
Set(me: in out; S: HSurface from Adaptor3d)
Set(me: in out; S: TheSurface)
is static;
@@ -66,7 +70,7 @@ is
is static;
Set(me: in out; A: HCurve2d from Adaptor2d)
Set(me: in out; A: TheArc)
---C++: inline
is static;
@@ -117,8 +121,8 @@ is
fields
myArc : HCurve2d from Adaptor2d;
mySurf : HSurface from Adaptor3d;
myArc : TheArc;
mySurf : TheSurface;
myMean : Real from Standard;
myType : TFunction from Contap;
myDir : Dir from gp;

View File

@@ -14,34 +14,31 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_ArcFunction.ixx>
#include <Contap_HContTool.hxx>
#include <Contap_SurfProps.hxx>
#include <Contap_HCurve2dTool.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
Contap_ArcFunction::Contap_ArcFunction ():
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.)
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.)
{}
void Contap_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
void Contap_ArcFunction::Set(const TheSurface& S)
{
mySurf = S;
Standard_Integer i;
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Integer nbs = TheContTool::NbSamplePoints(S);
Standard_Real U,V;
// gp_Vec d1u,d1v;
// gp_Vec d1u,d1v;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);
TheContTool::SamplePoint(S,i,U,V);
// TheSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
TheSurfProps::Normale(S,U,V,solpt,norm);
myMean = myMean + norm.Magnitude();
}
myMean = myMean / ((Standard_Real)nbs);
@@ -50,14 +47,14 @@ void Contap_ArcFunction::Set(const Handle(Adaptor3d_HSurface)& S)
Standard_Boolean Contap_ArcFunction::Value (const Standard_Real U,
Standard_Real& F)
Standard_Real& F)
{
//gp_Vec d1u,d1v;
gp_Pnt2d pt2d(Contap_HCurve2dTool::Value(myArc,U));
// Adaptor3d_HSurfaceTool::D1(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Pnt2d pt2d(TheArcTool::Value(myArc,U));
// TheSurfaceTool::D1(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm;
Contap_SurfProps::Normale(mySurf,pt2d.X(),pt2d.Y(),solpt,norm);
TheSurfProps::Normale(mySurf,pt2d.X(),pt2d.Y(),solpt,norm);
switch (myType) {
case Contap_ContourStd:
@@ -85,22 +82,22 @@ Standard_Boolean Contap_ArcFunction::Value (const Standard_Real U,
Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
Standard_Real& D)
Standard_Real& D)
{
gp_Pnt2d pt2d;
gp_Vec2d d2d;
Standard_Real dfu =0.,dfv =0.;
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
Contap_HCurve2dTool::D1(myArc,U,pt2d,d2d);
// Adaptor3d_HSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
TheArcTool::D1(myArc,U,pt2d,d2d);
// TheSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
gp_Vec norm,dnu,dnv;
Contap_SurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
TheSurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
dfu = (dnu.Dot(myDir))/myMean;
dfv = (dnv.Dot(myDir))/myMean;
}
@@ -108,21 +105,21 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
case Contap_ContourPrs:
{
gp_Vec Ep(myEye,solpt);
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
dfu = (dnu.Dot(Ep))/myMean;
dfv = (dnv.Dot(Ep))/myMean;
}
break;
case Contap_DraftStd:
{
/*
/*
gp_Vec norm(d1u.Crossed(d1v).Normalized());
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
dfu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
*/
norm.Normalized();
dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
@@ -138,25 +135,25 @@ Standard_Boolean Contap_ArcFunction::Derivative (const Standard_Real U,
}
Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
Standard_Real& F,
Standard_Real& D)
Standard_Real& F,
Standard_Real& D)
{
gp_Pnt2d pt2d;
gp_Vec2d d2d;
Standard_Real dfu =0.,dfv =0.;
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
Contap_HCurve2dTool::D1(myArc,U,pt2d,d2d);
// Adaptor3d_HSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
// gp_Vec d1u,d1v,d2u,d2v,d2uv;
TheArcTool::D1(myArc,U,pt2d,d2d);
// TheSurfaceTool::D2(mySurf,pt2d.X(),pt2d.Y(),solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm,dnu,dnv;
Contap_SurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
TheSurfProps::NormAndDn(mySurf,pt2d.X(),pt2d.Y(),solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
F = (norm.Dot(myDir))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
dfu = (dnu.Dot(myDir))/myMean;
dfv = (dnv.Dot(myDir))/myMean;
}
@@ -165,8 +162,8 @@ Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
{
gp_Vec Ep(myEye,solpt);
F = (norm.Dot(Ep))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
// dfu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// dfv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
dfu = (dnu.Dot(Ep))/myMean;
dfv = (dnv.Dot(Ep))/myMean;
}
@@ -175,12 +172,12 @@ Standard_Boolean Contap_ArcFunction::Values (const Standard_Real U,
{
F = (norm.Dot(myDir)-myCosAng*norm.Magnitude())/myMean;
norm.Normalize();
/*
/*
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
dfu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
dfv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
*/
dfu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
dfv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
@@ -203,9 +200,9 @@ Standard_Integer Contap_ArcFunction::GetStateNumber ()
Standard_Integer Contap_ArcFunction::NbSamples () const
{
return Max(Max(Contap_HContTool::NbSamplesU(mySurf,0.,0.),
Contap_HContTool::NbSamplesV(mySurf,0.,0.)),
Contap_HContTool::NbSamplesOnArc(myArc));
return Max(Max(TheContTool::NbSamplesU(mySurf,0.,0.),
TheContTool::NbSamplesV(mySurf,0.,0.)),
TheContTool::NbSamplesOnArc(myArc));
}
//modified by NIZNHY-PKV Thu Mar 29 16:53:07 2001f
@@ -213,7 +210,7 @@ Standard_Integer Contap_ArcFunction::NbSamples () const
//function : Quadric
//purpose : returns empty Quadric
//=======================================================================
const IntSurf_Quadric& Contap_ArcFunction::Quadric() const
const IntSurf_Quadric& Contap_ArcFunction::Quadric() const
{
return(myQuad);
}

View File

@@ -42,7 +42,7 @@ inline void Contap_ArcFunction::Set(const gp_Pnt& Eye)
myEye = Eye;
}
inline void Contap_ArcFunction::Set(const Handle(Adaptor2d_HCurve2d)& A)
inline void Contap_ArcFunction::Set(const TheArc& A)
{
myArc = A;
seqpt.Clear();

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,16 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Contour from Contap
generic class ContourGen from Contap
(TheVertex as any;
TheArc as any;
TheSurface as any;
TheArcTool as any;
TheSurfaceTool as any;
TheContTool as any; -- as ContTool from Contap(TheVertex,TheArc,
-- TheSurface)
TheTopolTool as Transient)
uses PathPoint from IntSurf,
PathPointTool from IntSurf,
@@ -23,70 +32,130 @@ uses PathPoint from IntSurf,
InteriorPointTool from IntSurf,
SequenceOfInteriorPoint from IntSurf,
Pnt from gp,
Vec from gp,
Point from Contap,
Line from Contap,
SurfFunction from Contap,
ArcFunction from Contap,
TheSequenceOfLine from Contap,
TheSearch from Contap,
TheSearchInside from Contap,
HSurface from Adaptor3d,
TopolTool from Adaptor3d
Vec from gp
raises NotDone from StdFail,
OutOfRange from Standard,
ConstructionError from Standard
class ThePoint instantiates Point from Contap
(TheVertex,
TheArc);
class TheSequenceOfPoint instantiates Sequence from TCollection
(ThePoint);
class TheHSequenceOfPoint instantiates HSequence from TCollection
(ThePoint,TheSequenceOfPoint);
class TheLine instantiates Line from Contap
(TheVertex,
TheArc,
ThePoint,
TheHSequenceOfPoint);
class TheSequenceOfLine instantiates Sequence from TCollection
(TheLine);
class TheSurfProps instantiates SurfProps from Contap
(TheSurface,
TheSurfaceTool);
class TheSurfFunction instantiates SurfFunction from Contap
(TheSurface,
TheSurfaceTool,
TheSurfProps from Contap,
TheContTool);
class TheArcFunction instantiates ArcFunction from Contap
(TheArc,
TheSurface,
TheArcTool,
TheSurfaceTool,
TheSurfProps from Contap,
TheContTool);
class TheSearch instantiates SearchOnBoundaries from IntStart
(TheVertex,
TheArc,
TheArcTool,
TheContTool,
TheTopolTool,
TheArcFunction from Contap);
class TheIWalking instantiates IWalking from IntWalk
(PathPoint from IntSurf,
PathPointTool from IntSurf,
SequenceOfPathPoint from IntSurf,
InteriorPoint from IntSurf,
InteriorPointTool from IntSurf,
SequenceOfInteriorPoint from IntSurf,
TheSurface,
TheSurfaceTool,
TheSurfFunction from Contap);
class TheSearchInside instantiates SearchInside from IntStart
(TheSurface,
TheSurfaceTool,
TheTopolTool,
TheContTool,
TheSurfFunction from Contap);
is
Create
returns Contour from Contap;
returns ContourGen from Contap;
Create(Direction: Vec from gp)
returns Contour from Contap;
returns ContourGen from Contap;
Create(Direction: Vec from gp; Angle: Real from Standard)
returns Contour from Contap;
returns ContourGen from Contap;
Create(Eye: Pnt from gp)
returns Contour from Contap;
returns ContourGen from Contap;
Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Create(Surf: TheSurface; Domain: TheTopolTool;
Direction: Vec from gp)
---Purpose: Creates the contour in a given direction.
returns Contour from Contap;
returns ContourGen from Contap;
Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Create(Surf: TheSurface; Domain: TheTopolTool;
Direction: Vec from gp; Angle: Real from Standard)
---Purpose: Creates the contour in a given direction.
returns Contour from Contap;
returns ContourGen from Contap;
Create(Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Create(Surf: TheSurface; Domain: TheTopolTool;
Eye: Pnt from gp)
---Purpose: Creates the contour for a perspective view.
returns Contour from Contap;
returns ContourGen from Contap;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d)
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool)
---Purpose: Creates the contour in a given direction.
@@ -94,7 +163,7 @@ is
is static;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool;
Direction: Vec from gp)
---Purpose: Creates the contour in a given direction.
@@ -102,7 +171,7 @@ is
is static;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool;
Direction: Vec from gp; Angle: Real from Standard)
---Purpose: Creates the contour in a given direction.
@@ -110,7 +179,7 @@ is
is static;
Perform(me: in out; Surf: HSurface from Adaptor3d; Domain: TopolTool from Adaptor3d;
Perform(me: in out; Surf: TheSurface; Domain: TheTopolTool;
Eye: Pnt from gp)
---Purpose: Creates the contour for a perspective view.
@@ -165,7 +234,7 @@ is
Line(me; Index: Integer from Standard)
returns Line from Contap
returns TheLine from Contap
---C++: return const&
---C++: inline
@@ -176,7 +245,7 @@ is
SurfaceFunction(me : in out)
returns SurfFunction
returns TheSurfFunction
---Purpose: Returns a reference on the internal
-- SurfaceFunction. This is used to compute tangents
-- on the lines.
@@ -185,12 +254,12 @@ is
is static;
Perform(me: in out; Domain: TopolTool from Adaptor3d)
Perform(me: in out; Domain: TheTopolTool)
is static private;
PerformAna(me: in out; Domain: TopolTool from Adaptor3d)
PerformAna(me: in out; Domain: TheTopolTool)
is static private;
@@ -201,8 +270,8 @@ fields
slin : TheSequenceOfLine from Contap;
solrst : TheSearch from Contap;
solins : TheSearchInside from Contap;
mySFunc : SurfFunction from Contap;
myAFunc : ArcFunction from Contap;
mySFunc : TheSurfFunction from Contap;
myAFunc : TheArcFunction from Contap;
modeset : Boolean from Standard;
end Contour;
end ContourGen;

View File

@@ -0,0 +1,31 @@
// Created on: 1993-02-05
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <ElCLib.hxx>
#include <gp_Pln.hxx>
#include <gp_Sphere.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Cone.hxx>
#include <gp_Lin.hxx>
#include <gp_Circ.hxx>
#include <Contap_ContAna.hxx>
#include <math_FunctionSetRoot.hxx>
#include <IntSurf.hxx>
#include <Contap_ContourGen_1.gxx>
#include <Contap_ContourGen_2.gxx>
#include <Contap_ContourGen_3.gxx>

View File

@@ -16,31 +16,31 @@
#include <StdFail_NotDone.hxx>
inline Standard_Boolean Contap_Contour::IsDone () const
inline Standard_Boolean Contap_ContourGen::IsDone () const
{
return done;
}
inline Standard_Boolean Contap_Contour::IsEmpty () const
inline Standard_Boolean Contap_ContourGen::IsEmpty () const
{
return NbLines()==0;
}
inline Standard_Integer Contap_Contour::NbLines () const
inline Standard_Integer Contap_ContourGen::NbLines () const
{
if (!done) {StdFail_NotDone::Raise();}
return slin.Length();
}
inline const Contap_Line &
Contap_Contour::Line (const Standard_Integer Index) const
inline const Contap_TheLine &
Contap_ContourGen::Line (const Standard_Integer Index) const
{
if (!done) {StdFail_NotDone::Raise();}
return slin(Index);
}
inline Contap_SurfFunction &
Contap_Contour::SurfaceFunction ()
inline Contap_TheSurfFunction &
Contap_ContourGen::SurfaceFunction ()
{
if (!done) {StdFail_NotDone::Raise();}
return mySFunc;

View File

@@ -0,0 +1,167 @@
// Created on: 1993-02-05
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_ConstructionError.hxx>
Contap_ContourGen::Contap_ContourGen () :
done(Standard_False),modeset(Standard_False)
{}
Contap_ContourGen::Contap_ContourGen (const gp_Vec& Direction) :
done(Standard_False),modeset(Standard_True)
{
mySFunc.Set(Direction);
myAFunc.Set(Direction);
}
Contap_ContourGen::Contap_ContourGen (const gp_Vec& Direction,
const Standard_Real Angle) :
done(Standard_False),modeset(Standard_True)
{
mySFunc.Set(Direction,Angle);
myAFunc.Set(Direction,Angle);
}
Contap_ContourGen::Contap_ContourGen (const gp_Pnt& Eye) :
done(Standard_False),modeset(Standard_True)
{
mySFunc.Set(Eye);
myAFunc.Set(Eye);
}
Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction) :
done(Standard_False),modeset(Standard_True)
{
Perform(Surf,Domain,Direction);
}
Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction,
const Standard_Real Angle) :
done(Standard_False),modeset(Standard_True)
{
Perform(Surf,Domain,Direction,Angle);
}
Contap_ContourGen::Contap_ContourGen (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Pnt& Eye) :
done(Standard_False),modeset(Standard_True)
{
Perform(Surf,Domain,Eye);
}
void Contap_ContourGen::Init (const gp_Vec& Direction)
{
done = Standard_False;
modeset = Standard_True;
mySFunc.Set(Direction);
myAFunc.Set(Direction);
}
void Contap_ContourGen::Init(const gp_Vec& Direction,
const Standard_Real Angle)
{
done = Standard_False;
modeset = Standard_True;
mySFunc.Set(Direction,Angle);
myAFunc.Set(Direction,Angle);
}
void Contap_ContourGen::Init (const gp_Pnt& Eye)
{
done = Standard_False;
modeset = Standard_True;
mySFunc.Set(Eye);
myAFunc.Set(Eye);
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain)
{
if (!modeset) {Standard_ConstructionError::Raise();}
mySFunc.Set(Surf);
myAFunc.Set(Surf);
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
switch (typS) {
case GeomAbs_Plane:
case GeomAbs_Sphere:
case GeomAbs_Cylinder:
case GeomAbs_Cone:
{
PerformAna(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
}
break;
default:
{
Perform(Domain); //Surf,Domain,Direction,0.,gp_Pnt(0.,0.,0.),1);
}
break;
}
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction)
{
Init(Direction);
Perform(Surf,Domain);
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Vec& Direction,
const Standard_Real Angle)
{
Init(Direction,Angle);
Perform(Surf,Domain);
}
void Contap_ContourGen::Perform (const TheSurface& Surf,
const Handle(TheTopolTool)& Domain,
const gp_Pnt& Eye)
{
Init(Eye);
Perform(Surf,Domain);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,442 @@
// Created on: 1993-02-05
// Created by: Jacques GOUSSARD
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#define Tolpetit 1.e-10 // pour dist au carre
#include <ElSLib.hxx>
#include <TColStd_SequenceOfInteger.hxx>
static Standard_Boolean FindLine(Contap_TheLine& Line,
const TheSurface& Surf,
const gp_Pnt2d& Pt2d,
gp_Pnt& Ptref,
Standard_Real& Paramin,
gp_Vec& Tgmin,
gp_Vec& Norm)
{
// Standard_Integer i;
gp_Pnt pt,ptmin;
gp_Vec tg;
Standard_Real para,dist;
Standard_Real dismin = RealLast();
Contap_TheSurfProps::Normale(Surf,Pt2d.X(),Pt2d.Y(),Ptref,Norm);
if (Line.TypeContour() == Contap_Lin) {
gp_Lin lin(Line.Line());
para = ElCLib::Parameter(lin,Ptref);
ElCLib::D1(para,lin,pt,tg);
dist = pt.Distance(Ptref) + Abs(Norm.Dot(lin.Direction()));
}
else { // Contap__Circle
gp_Circ cir(Line.Circle());
para = ElCLib::Parameter(cir,Ptref);
ElCLib::D1(para,cir,pt,tg);
dist = pt.Distance(Ptref)+Abs(Norm.Dot(tg/cir.Radius()));
}
if (dist < dismin) {
dismin = dist;
Paramin = para;
ptmin = pt;
Tgmin = tg;
}
if (ptmin.SquareDistance(Ptref) <= Tolpetit) {
return Standard_True;
}
else {
return Standard_False;
}
}
static void PutPointsOnLine (const Contap_TheSearch& solrst,
const TheSurface& Surf,
Contap_TheSequenceOfLine& slin)
{
Standard_Integer i,l;//,index;
Standard_Integer NbPoints = solrst.NbPoints();
Standard_Real theparam;
IntSurf_Transition TLine,TArc;
Standard_Boolean goon;
gp_Pnt2d pt2d;
gp_Vec2d d2d;
gp_Pnt ptonsurf;
gp_Vec vectg,normale,tgtrst;
Standard_Real paramlin = 0.0;
Standard_Integer nbLin = slin.Length();
for(l=1;l<=nbLin;l++) {
Contap_TheLine& Line=slin.ChangeValue(l);
for (i=1; i<= NbPoints; i++) {
const Contap_ThePathPointOfTheSearch& PStart = solrst.Point(i);
const TheArc& thearc = PStart.Arc();
theparam = PStart.Parameter();
TheArcTool::D1(thearc,theparam,pt2d,d2d);
goon = FindLine(Line,Surf,pt2d,ptonsurf,paramlin,vectg,normale);
Contap_ThePoint PPoint;
if (goon) {
gp_Vec d1u,d1v;
gp_Pnt bidpt;
TheSurfaceTool::D1(Surf,pt2d.X(),pt2d.Y(),bidpt,d1u,d1v);
PPoint.SetValue(ptonsurf,pt2d.X(),pt2d.Y());
if (normale.Magnitude() < RealEpsilon()) {
TLine.SetValue();
TArc.SetValue();
}
else {
// Petit test qui devrait permettre de bien traiter les pointes
// des cones, et les sommets d`une sphere. Il faudrait peut-etre
// rajouter une methode dans SurfProps
if (Abs(d2d.Y()) <= Precision::Confusion()) {
tgtrst = d1v.Crossed(normale);
if(d2d.X() < 0.0)
tgtrst.Reverse();
}
else {
tgtrst.SetLinearForm(d2d.X(),d1u,d2d.Y(),d1v);
}
IntSurf::MakeTransition(vectg,tgtrst,normale,TLine,TArc);
}
PPoint.SetArc(thearc,theparam, TLine, TArc);
PPoint.SetParameter(paramlin);
if (!PStart.IsNew()) {
PPoint.SetVertex(PStart.Vertex());
}
Line.Add(PPoint);
}
}
}
}
//----------------------------------------------------------------------------------
//-- Orientation des contours Apparents quand ceux-ci sont des lignes ou des cercles
//-- On prend un point de la ligne ou du cercle ---> P
//-- On projete ce point sur la surface P ---> u,v
//-- et on evalue la transition au point u,v
//----------------------------------------------------------------------------------
IntSurf_TypeTrans ComputeTransitionOngpLine
(Contap_TheSurfFunction& SFunc,
const gp_Lin& L)
{
const TheSurface& Surf=SFunc.Surface();
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
gp_Pnt P;
gp_Vec T;
ElCLib::D1(0.0,L,P,T);
Standard_Real u = 0.,v = 0.;
switch (typS) {
case GeomAbs_Cylinder: {
ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),P,u,v);
break;
}
case GeomAbs_Cone: {
ElSLib::Parameters(TheSurfaceTool::Cone(Surf),P,u,v);
break;
}
case GeomAbs_Sphere: {
ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),P,u,v);
break;
}
default:
break;
}
return(ComputeTransitionOnLine(SFunc,u,v,T));
}
IntSurf_TypeTrans ComputeTransitionOngpCircle
(Contap_TheSurfFunction& SFunc,
const gp_Circ& C)
{
const TheSurface& Surf=SFunc.Surface();
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
gp_Pnt P;
gp_Vec T;
ElCLib::D1(0.0,C,P,T);
Standard_Real u = 0.,v = 0.;
switch (typS) {
case GeomAbs_Cylinder: {
ElSLib::Parameters(TheSurfaceTool::Cylinder(Surf),P,u,v);
break;
}
case GeomAbs_Cone: {
ElSLib::Parameters(TheSurfaceTool::Cone(Surf),P,u,v);
break;
}
case GeomAbs_Sphere: {
ElSLib::Parameters(TheSurfaceTool::Sphere(Surf),P,u,v);
break;
}
default:
break;
}
return(ComputeTransitionOnLine(SFunc,u,v,T));
}
void Contap_ContourGen::PerformAna(const Handle(TheTopolTool)& Domain)
{
done = Standard_False;
slin.Clear();
Standard_Real TolArc = 1.e-5;
Standard_Integer nbCont, nbPointRst, i;
//gp_Circ cirsol;
//gp_Lin linsol;
Contap_ContAna contana;
Contap_TheLine theline;
const TheSurface& Surf = mySFunc.Surface();
Contap_TFunction TypeFunc(mySFunc.FunctionType());
Standard_Boolean PerformSolRst = Standard_True;
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(Surf);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(TheSurfaceTool::Plane(Surf));
switch (TypeFunc) {
case Contap_ContourStd:
{
gp_Dir Dirpln(pl.Axis().Direction());
if (Abs(mySFunc.Direction().Dot(Dirpln)) > Precision::Angular()) {
// Aucun point du plan n`est solution, en particulier aucun point
// sur restriction.
PerformSolRst = Standard_False;
}
}
break;
case Contap_ContourPrs:
{
gp_Pnt Eye(mySFunc.Eye());
if (pl.Distance(Eye) > Precision::Confusion()) {
// Aucun point du plan n`est solution, en particulier aucun point
// sur restriction.
PerformSolRst = Standard_False;
}
}
break;
case Contap_DraftStd:
{
gp_Dir Dirpln(pl.Axis().Direction());
Standard_Real Sina = Sin(mySFunc.Angle());
if (Abs(mySFunc.Direction().Dot(Dirpln)+ Sina) > //voir SurfFunction
Precision::Angular()) {
PerformSolRst = Standard_False;
}
}
break;
case Contap_DraftPrs:
default:
{
}
}
}
break;
case GeomAbs_Sphere:
{
switch (TypeFunc) {
case Contap_ContourStd:
{
contana.Perform(TheSurfaceTool::Sphere(Surf),mySFunc.Direction());
}
break;
case Contap_ContourPrs:
{
contana.Perform(TheSurfaceTool::Sphere(Surf),mySFunc.Eye());
}
break;
case Contap_DraftStd:
{
contana.Perform(TheSurfaceTool::Sphere(Surf),
mySFunc.Direction(),mySFunc.Angle());
}
break;
case Contap_DraftPrs:
default:
{
}
}
}
break;
case GeomAbs_Cylinder:
{
switch (TypeFunc) {
case Contap_ContourStd:
{
contana.Perform(TheSurfaceTool::Cylinder(Surf),mySFunc.Direction());
}
break;
case Contap_ContourPrs:
{
contana.Perform(TheSurfaceTool::Cylinder(Surf),mySFunc.Eye());
}
break;
case Contap_DraftStd:
{
contana.Perform(TheSurfaceTool::Cylinder(Surf),
mySFunc.Direction(),mySFunc.Angle());
}
break;
case Contap_DraftPrs:
default:
{
}
}
}
break;
case GeomAbs_Cone:
{
switch (TypeFunc) {
case Contap_ContourStd:
{
contana.Perform(TheSurfaceTool::Cone(Surf),mySFunc.Direction());
}
break;
case Contap_ContourPrs:
{
contana.Perform(TheSurfaceTool::Cone(Surf),mySFunc.Eye());
}
break;
case Contap_DraftStd:
{
contana.Perform(TheSurfaceTool::Cone(Surf),
mySFunc.Direction(),mySFunc.Angle());
}
break;
case Contap_DraftPrs:
default:
{
}
}
default:
break;
}
break;
}
if (typS != GeomAbs_Plane) {
if (!contana.IsDone()) {
return;
}
nbCont = contana.NbContours();
if (contana.NbContours() == 0) {
done = Standard_True;
return;
}
GeomAbs_CurveType typL = contana.TypeContour();
if (typL == GeomAbs_Circle) {
theline.SetValue(contana.Circle());
IntSurf_TypeTrans TransCircle;
TransCircle = ComputeTransitionOngpCircle(mySFunc,contana.Circle());
theline.SetTransitionOnS(TransCircle);
slin.Append(theline);
}
else if (typL == GeomAbs_Line) {
for (i=1; i<=nbCont; i++) {
theline.SetValue(contana.Line(i));
IntSurf_TypeTrans TransLine;
TransLine = ComputeTransitionOngpLine(mySFunc,contana.Line(i));
theline.SetTransitionOnS(TransLine);
slin.Append(theline);
theline.Clear();
}
/*
if (typS == GeomAbs_Cone) {
Standard_Real u,v;
gp_Cone thecone(TheSurfaceTool::Cone(Surf));
ElSLib::Parameters(thecone,thecone.Apex(),u,v);
Contap_ThePoint vtxapex(thecone.Apex(),u,v);
vtxapex.SetInternal();
vtxapex.SetMultiple();
for (i=1; i<=nbCont i++) {
slin.ChangeValue(i).Add(vtxapex);
}
}
*/
}
}
if(PerformSolRst) {
solrst.Perform(myAFunc,Domain,TolArc,TolArc);
if (!solrst.IsDone()) {
return;
}
nbPointRst = solrst.NbPoints();
if (nbPointRst != 0) {
PutPointsOnLine(solrst,Surf,slin);
}
if (solrst.NbSegments() !=0) {
ProcessSegments(solrst,slin,TolArc,mySFunc,Domain);
}
//-- lbr
//Standard_Boolean oneremov;
Standard_Integer nblinto = slin.Length();
TColStd_SequenceOfInteger SeqToDestroy;
//-- cout<<" Construct Contour_3 nblin = "<<nblinto<<endl;
for(i=1; i<= nblinto ; i++) {
//-- cout<<" nbvtx : "<<slin.Value(i).NbVertex()<<endl;
//--if(slin.Value(i).NbVertex() > 1) {
if(slin.Value(i).TypeContour() != Contap_Restriction) {
LineConstructor(slin,Domain,slin.ChangeValue(i),Surf);
SeqToDestroy.Append(i);
}
//-- }
}
for(i=SeqToDestroy.Length(); i>=1; i--) {
slin.Remove(SeqToDestroy.Value(i));
}
}
done = Standard_True;
}

View File

@@ -14,44 +14,46 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class HContTool from Contap
generic class HContToolGen from Contap (
TheHVertex as any;
TheHCurve2d as any;
TheHSurface as any;
TheHCurve2dTool as any;
TheHSurfaceTool as any)
---Purpose: Tool for the intersection between 2 surfaces.
-- Regroupe pour l instant les methodes hors Adaptor3d...
uses
Pnt2d from gp,
Pnt from gp,
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
HSurface from Adaptor3d,
HCurve2dTool from Contap,
HSurfaceTool from Adaptor3d
Pnt2d from gp,
Pnt from gp
is
NbSamplesU(myclass; S: HSurface from Adaptor3d; u1,u2: Real from Standard)
NbSamplesU(myclass; S: TheHSurface; u1,u2: Real from Standard)
returns Integer from Standard;
NbSamplesV(myclass; S: HSurface from Adaptor3d; v1,v2: Real from Standard)
NbSamplesV(myclass; S: TheHSurface; v1,v2: Real from Standard)
returns Integer from Standard;
-- Methodes pour recherche des points interieurs
NbSamplePoints(myclass; S: HSurface from Adaptor3d)
NbSamplePoints(myclass; S: TheHSurface)
returns Integer from Standard;
SamplePoint(myclass; S : HSurface from Adaptor3d;
SamplePoint(myclass; S : TheHSurface;
Index: Integer from Standard;
U,V: out Real from Standard);
-- Methodes sur un arc de restriction
HasBeenSeen(myclass; C: HCurve2d from Adaptor2d)
HasBeenSeen(myclass; C: TheHCurve2d)
---Purpose: Returns True if all the intersection point and edges
-- are known on the Arc.
@@ -61,7 +63,7 @@ is
returns Boolean from Standard;
NbSamplesOnArc(myclass; A: HCurve2d from Adaptor2d)
NbSamplesOnArc(myclass; A: TheHCurve2d)
---Purpose: returns the number of points which is used to make
-- a sample on the arc. this number is a function of
@@ -70,7 +72,7 @@ is
returns Integer from Standard;
Bounds(myclass; C: HCurve2d from Adaptor2d;
Bounds(myclass; C: TheHCurve2d;
Ufirst,Ulast: out Real from Standard);
---Purpose: Returns the parametric limits on the arc C.
@@ -79,7 +81,7 @@ is
-- or a bounding box for an infinite arc.
Project(myclass; C: HCurve2d from Adaptor2d;
Project(myclass; C: TheHCurve2d;
P: Pnt2d from gp;
Paramproj: out Real from Standard;
Ptproj : out Pnt2d from gp)
@@ -98,7 +100,7 @@ is
-- Methods on a vertex
Tolerance(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
Tolerance(myclass; V: TheHVertex; C: TheHCurve2d)
---Purpose: Returns the parametric tolerance used to consider
-- that the vertex and another point meet, i-e
@@ -108,7 +110,7 @@ is
returns Real from Standard;
Parameter(myclass; V: HVertex from Adaptor3d; C: HCurve2d from Adaptor2d)
Parameter(myclass; V: TheHVertex; C: TheHCurve2d)
---Purpose: Returns the parameter of the vertex V on the arc A.
@@ -117,14 +119,14 @@ is
-- The following methods are used when HasBeenSeen returns Standard_True
NbPoints(myclass; C: HCurve2d from Adaptor2d)
NbPoints(myclass; C: TheHCurve2d)
---Purpose: Returns the number of intersection points on the arc A.
returns Integer from Standard;
Value(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
Value(myclass; C: TheHCurve2d; Index: Integer from Standard;
Pt: out Pnt from gp; Tol: out Real from Standard;
U: out Real from Standard);
@@ -133,7 +135,7 @@ is
-- point of range Index.
IsVertex(myclass; C: HCurve2d from Adaptor2d;
IsVertex(myclass; C: TheHCurve2d;
Index: Integer from Standard)
---Purpose: Returns True if the intersection point of range Index
@@ -142,14 +144,14 @@ is
returns Boolean from Standard;
Vertex(myclass; C: HCurve2d from Adaptor2d; Index: Integer from Standard;
V: out HVertex from Adaptor3d);
Vertex(myclass; C: TheHCurve2d; Index: Integer from Standard;
V: out TheHVertex);
---Purpose: When IsVertex returns True, this method returns the
-- vertex on the arc A.
NbSegments(myclass; C: HCurve2d from Adaptor2d)
NbSegments(myclass; C: TheHCurve2d)
---Purpose: returns the number of part of A solution of the
-- of intersection problem.
@@ -157,7 +159,7 @@ is
returns Integer from Standard;
HasFirstPoint(myclass; C: HCurve2d from Adaptor2d;
HasFirstPoint(myclass; C: TheHCurve2d;
Index: Integer from Standard;
IndFirst: out Integer from Standard)
@@ -171,7 +173,7 @@ is
returns Boolean from Standard;
HasLastPoint(myclass; C: HCurve2d from Adaptor2d;
HasLastPoint(myclass; C: TheHCurve2d;
Index: Integer from Standard;
IndLast: out Integer from Standard)
@@ -185,7 +187,7 @@ is
returns Boolean from Standard;
IsAllSolution(myclass; C: HCurve2d from Adaptor2d)
IsAllSolution(myclass; C: TheHCurve2d)
---Purpose: Returns True when the whole restriction is solution
-- of the intersection problem.
@@ -193,4 +195,4 @@ is
returns Boolean from Standard;
end HContTool;
end HContToolGen;

View File

@@ -14,17 +14,33 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_HContTool.ixx>
#include <Extrema_EPCOfExtPC2d.hxx>
#include <Extrema_POnCurv2d.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <Standard_OutOfRange.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
static Standard_Real uinf,vinf,usup,vsup;
Standard_Integer Contap_HContTool::NbSamplesV
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
const Standard_Real )
#include TheHSurface_hxx
#include TheHCurve2d_hxx
#include TheHVertex_hxx
Standard_Integer Contap_HContToolGen::NbSamplesV
(const TheHSurface& S,
const Standard_Real ,
const Standard_Real )
{
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S->GetType();
@@ -45,7 +61,7 @@ Standard_Integer Contap_HContTool::NbSamplesV
nbs = S->NbVKnots();
nbs*= S->VDegree();
if(nbs < 2) nbs=2;
}
break;
case GeomAbs_Cylinder:
@@ -58,7 +74,7 @@ Standard_Integer Contap_HContTool::NbSamplesV
nbs = 15;
}
break;
default:
{
nbs = 10;
@@ -68,10 +84,10 @@ Standard_Integer Contap_HContTool::NbSamplesV
return(nbs);
}
Standard_Integer Contap_HContTool::NbSamplesU
(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real ,
const Standard_Real )
Standard_Integer Contap_HContToolGen::NbSamplesU
(const TheHSurface& S,
const Standard_Real ,
const Standard_Real )
{
Standard_Integer nbs;
GeomAbs_SurfaceType typS = S->GetType();
@@ -92,7 +108,7 @@ Standard_Integer Contap_HContTool::NbSamplesU
nbs = S->NbUKnots();
nbs*= S->UDegree();
if(nbs < 2) nbs=2;
}
break;
case GeomAbs_Torus:
@@ -109,7 +125,7 @@ Standard_Integer Contap_HContTool::NbSamplesU
nbs = 10;
}
break;
default:
{
nbs = 10;
@@ -119,8 +135,8 @@ Standard_Integer Contap_HContTool::NbSamplesU
return(nbs);
}
Standard_Integer Contap_HContTool::NbSamplePoints
(const Handle(Adaptor3d_HSurface)& S)
Standard_Integer Contap_HContToolGen::NbSamplePoints
(const TheHSurface& S)
{
uinf = S->FirstUParameter();
usup = S->LastUParameter();
@@ -131,8 +147,8 @@ Standard_Integer Contap_HContTool::NbSamplePoints
Standard_Real temp = uinf;
uinf = usup;
usup = temp;
}
if (vsup < vinf) {
}
if (vsup < vinf) {
Standard_Real temp = vinf;
vinf = vsup;
vsup = temp;
@@ -147,7 +163,7 @@ Standard_Integer Contap_HContTool::NbSamplePoints
else if (usup == RealLast()) {
usup = uinf + 2.e5;
}
if (vinf == RealFirst() && vsup == RealLast()) {
vinf = -1.e5;
vsup = 1.e5;
@@ -167,10 +183,10 @@ Standard_Integer Contap_HContTool::NbSamplePoints
return 5;
}
void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
const Standard_Integer Index,
Standard_Real& U,
Standard_Real& V )
void Contap_HContToolGen::SamplePoint (const TheHSurface& S,
const Standard_Integer Index,
Standard_Real& U,
Standard_Real& V )
{
if(S->GetType() == GeomAbs_BSplineSurface) {
Standard_Integer nbIntU = NbSamplesU(S,uinf,usup)/3;
@@ -178,17 +194,17 @@ void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
if(nbIntU * nbIntV >5) {
Standard_Integer indU = (Index-1)/nbIntU; //---- 0 --> nbIntV
Standard_Integer indV = (Index-1) - indU*nbIntU; //---- 0 --> nbIntU
U = uinf + ((usup-uinf)/((Standard_Real)(nbIntU+1)))*(Standard_Real)(indU+1);
V = vinf + ((vsup-vinf)/((Standard_Real)(nbIntV+2)))*(Standard_Real)(indV+1);
//-- cout<<"Index :"<<Index<<" uinf:"<<uinf<<" usup:"<<usup<<" vinf:"<<vinf<<" vsup:"<<vsup<<" ";
//-- cout<<" ("<<indU<<"/"<<nbIntU<<" ->U:"<<U<<" ";
//-- cout<<" ("<<indV<<"/"<<nbIntV<<" ->V:"<<V<<endl;
return;
}
}
switch (Index) {
case 1:
U = 0.75*uinf + 0.25*usup; //0.25;
@@ -213,8 +229,8 @@ void Contap_HContTool::SamplePoint (const Handle(Adaptor3d_HSurface)& S,
}
Standard_Integer Contap_HContTool::NbSamplesOnArc
(const Handle(Adaptor2d_HCurve2d)& A) {
Standard_Integer Contap_HContToolGen::NbSamplesOnArc
(const TheHCurve2d& A) {
GeomAbs_CurveType CurveType = A->GetType();
@@ -236,7 +252,7 @@ Standard_Integer Contap_HContTool::NbSamplesOnArc
//-- Handle_Geom2d_BSplineCurve& BSC=A->BSpline();
nbsOnC = 2 + A->NbKnots() * A->Degree();
break;
}
}
default:
nbsOnC = 10;
}
@@ -244,19 +260,19 @@ Standard_Integer Contap_HContTool::NbSamplesOnArc
}
void Contap_HContTool::Bounds(const Handle(Adaptor2d_HCurve2d)& A,
Standard_Real& Ufirst,
Standard_Real& Ulast)
void Contap_HContToolGen::Bounds(const TheHCurve2d& A,
Standard_Real& Ufirst,
Standard_Real& Ulast)
{
Ufirst = A->FirstParameter();
Ulast = A->LastParameter();
}
Standard_Boolean Contap_HContTool::Project (const Handle(Adaptor2d_HCurve2d)& C,
const gp_Pnt2d& P,
Standard_Real& Paramproj,
gp_Pnt2d& Ptproj)
Standard_Boolean Contap_HContToolGen::Project (const TheHCurve2d& C,
const gp_Pnt2d& P,
Standard_Real& Paramproj,
gp_Pnt2d& Ptproj)
{
@@ -287,80 +303,80 @@ Standard_Boolean Contap_HContTool::Project (const Handle(Adaptor2d_HCurve2d)& C,
}
Standard_Real Contap_HContTool::Tolerance (const Handle(Adaptor3d_HVertex)& V,
const Handle(Adaptor2d_HCurve2d)& C)
Standard_Real Contap_HContToolGen::Tolerance (const TheHVertex& V,
const TheHCurve2d& C)
{
// return BRepAdaptor2d_Curve2dTool::Resolution(C,BRep_Tool::Tolerance(V));
// return BRepAdaptor2d_Curve2dTool::Resolution(C,BRep_Tool::Tolerance(V));
return V->Resolution(C);
}
Standard_Real Contap_HContTool::Parameter (const Handle(Adaptor3d_HVertex)& V,
const Handle(Adaptor2d_HCurve2d)& C)
Standard_Real Contap_HContToolGen::Parameter (const TheHVertex& V,
const TheHCurve2d& C)
{
// return BRep_Tool::Parameter(V,C.Edge());
// return BRep_Tool::Parameter(V,C.Edge());
return V->Parameter(C);
}
Standard_Boolean Contap_HContTool::HasBeenSeen
(const Handle(Adaptor2d_HCurve2d)&)
Standard_Boolean Contap_HContToolGen::HasBeenSeen
(const TheHCurve2d&)
{
return Standard_False;
}
Standard_Integer Contap_HContTool::NbPoints(const Handle(Adaptor2d_HCurve2d)&)
Standard_Integer Contap_HContToolGen::NbPoints(const TheHCurve2d&)
{
return 0;
}
void Contap_HContTool::Value(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
gp_Pnt&,
Standard_Real&,
Standard_Real&)
void Contap_HContToolGen::Value(const TheHCurve2d&,
const Standard_Integer,
gp_Pnt&,
Standard_Real&,
Standard_Real&)
{
Standard_OutOfRange::Raise();
}
Standard_Boolean Contap_HContTool::IsVertex(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer)
Standard_Boolean Contap_HContToolGen::IsVertex(const TheHCurve2d&,
const Standard_Integer)
{
return Standard_False;
}
void Contap_HContTool::Vertex(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
Handle(Adaptor3d_HVertex)&)
void Contap_HContToolGen::Vertex(const TheHCurve2d&,
const Standard_Integer,
TheHVertex&)
{
Standard_OutOfRange::Raise();
}
Standard_Integer Contap_HContTool::NbSegments(const Handle(Adaptor2d_HCurve2d)&)
Standard_Integer Contap_HContToolGen::NbSegments(const TheHCurve2d&)
{
return 0;
}
Standard_Boolean Contap_HContTool::HasFirstPoint
(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
Standard_Integer&)
Standard_Boolean Contap_HContToolGen::HasFirstPoint
(const TheHCurve2d&,
const Standard_Integer,
Standard_Integer&)
{
Standard_OutOfRange::Raise();
return Standard_False;
return Standard_False;
}
Standard_Boolean Contap_HContTool::HasLastPoint
(const Handle(Adaptor2d_HCurve2d)&,
const Standard_Integer,
Standard_Integer&)
Standard_Boolean Contap_HContToolGen::HasLastPoint
(const TheHCurve2d&,
const Standard_Integer,
Standard_Integer&)
{
Standard_OutOfRange::Raise();
return Standard_False;
return Standard_False;
}
Standard_Boolean Contap_HContTool::IsAllSolution
(const Handle(Adaptor2d_HCurve2d)&)
Standard_Boolean Contap_HContToolGen::IsAllSolution
(const TheHCurve2d&)
{
return Standard_False;

View File

@@ -14,22 +14,22 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class HCurve2dTool from Contap
generic class HCurve2dToolGen from Contap (
CurveGen as any)
uses
Array1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec2d from gp,
Pnt2d from gp,
Circ2d from gp,
Elips2d from gp,
Hypr2d from gp,
Parab2d from gp,
Lin2d from gp,
BezierCurve from Geom2d,
BSplineCurve from Geom2d,
HCurve2d from Adaptor2d
Array1OfReal from TColStd,
Shape from GeomAbs,
CurveType from GeomAbs,
Vec2d from gp,
Pnt2d from gp,
Circ2d from gp,
Elips2d from gp,
Hypr2d from gp,
Parab2d from gp,
Lin2d from gp,
BezierCurve from Geom2d,
BSplineCurve from Geom2d
raises
@@ -43,12 +43,12 @@ is
-- Global methods - Apply to the whole curve.
--
FirstParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
FirstParameter(myclass; C: CurveGen) returns Real
---C++: inline
;
LastParameter(myclass; C: HCurve2d from Adaptor2d) returns Real
LastParameter(myclass; C: CurveGen) returns Real
---C++: inline
;
@@ -72,18 +72,18 @@ is
-- use the method Trim().
Continuity(myclass; C: HCurve2d from Adaptor2d) returns Shape from GeomAbs
Continuity(myclass; C: CurveGen) returns Shape from GeomAbs
---Purpose:
---C++: inline
;
NbIntervals(myclass; C: HCurve2d from Adaptor2d; S : Shape from GeomAbs) returns Integer
NbIntervals(myclass; C: CurveGen; S : Shape from GeomAbs) returns Integer
---Purpose: Returns the number of intervals for continuity
-- <S>. May be one if Continuity(myclass) >= <S>
---C++: inline
;
Intervals(myclass; C: HCurve2d from Adaptor2d; T : in out Array1OfReal from TColStd;
Intervals(myclass; C: CurveGen; T : in out Array1OfReal from TColStd;
S : Shape from GeomAbs)
---Purpose: Stores in <T> the parameters bounding the intervals
-- of continuity <S>.
@@ -95,31 +95,31 @@ is
---C++: inline
;
IsClosed(myclass; C: HCurve2d from Adaptor2d) returns Boolean
IsClosed(myclass; C: CurveGen) returns Boolean
---C++: inline
;
IsPeriodic(myclass; C: HCurve2d from Adaptor2d) returns Boolean
IsPeriodic(myclass; C: CurveGen) returns Boolean
---C++: inline
;
Period(myclass; C: HCurve2d from Adaptor2d) returns Real
Period(myclass; C: CurveGen) returns Real
raises
DomainError from Standard -- if the curve is not periodic
---C++: inline
;
Value(myclass; C: HCurve2d from Adaptor2d; U : Real) returns Pnt2d from gp
Value(myclass; C: CurveGen; U : Real) returns Pnt2d from gp
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D0 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp)
D0 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp)
--- Purpose : Computes the point of parameter U on the curve.
---C++: inline
;
D1 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
D1 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp ; V : out Vec2d from gp)
--- Purpose : Computes the point of parameter U on the curve with its
-- first derivative.
raises
@@ -129,7 +129,7 @@ is
---C++: inline
;
D2 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
D2 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp; V1, V2 : out Vec2d from gp)
--- Purpose :
-- Returns the point P of parameter U, the first and second
-- derivatives V1 and V2.
@@ -140,7 +140,7 @@ is
---C++: inline
;
D3 (myclass; C: HCurve2d from Adaptor2d; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
D3 (myclass; C: CurveGen; U : Real; P : out Pnt2d from gp; V1, V2, V3 : out Vec2d from gp)
--- Purpose :
-- Returns the point P of parameter U, the first, the second
-- and the third derivative.
@@ -151,7 +151,7 @@ is
---C++: inline
;
DN (myclass; C: HCurve2d from Adaptor2d; U : Real; N : Integer) returns Vec2d from gp
DN (myclass; C: CurveGen; U : Real; N : Integer) returns Vec2d from gp
--- Purpose :
-- The returned vector gives the value of the derivative for the
-- order of derivation N.
@@ -164,13 +164,13 @@ is
---C++: inline
;
Resolution(myclass; C: HCurve2d from Adaptor2d; R3d : Real) returns Real
Resolution(myclass; C: CurveGen; R3d : Real) returns Real
---Purpose : Returns the parametric resolution corresponding
-- to the real space resolution <R3d>.
---C++: inline
;
GetType(myclass; C: HCurve2d from Adaptor2d) returns CurveType from GeomAbs
GetType(myclass; C: CurveGen) returns CurveType from GeomAbs
---Purpose: Returns the type of the curve in the current
-- interval : Line, Circle, Ellipse, Hyperbola,
-- Parabola, BezierCurve, BSplineCurve, OtherCurve.
@@ -182,43 +182,43 @@ is
-- the corresponding type.
--
Line(myclass; C: HCurve2d from Adaptor2d) returns Lin2d from gp
Line(myclass; C: CurveGen) returns Lin2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Circle(myclass; C: HCurve2d from Adaptor2d) returns Circ2d from gp
Circle(myclass; C: CurveGen) returns Circ2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Ellipse(myclass; C: HCurve2d from Adaptor2d) returns Elips2d from gp
Ellipse(myclass; C: CurveGen) returns Elips2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Hyperbola(myclass; C: HCurve2d from Adaptor2d) returns Hypr2d from gp
Hyperbola(myclass; C: CurveGen) returns Hypr2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Parabola(myclass; C: HCurve2d from Adaptor2d) returns Parab2d from gp
Parabola(myclass; C: CurveGen) returns Parab2d from gp
raises
NoSuchObject from Standard
---C++: inline
;
Bezier(myclass; C: HCurve2d from Adaptor2d) returns BezierCurve from Geom2d
Bezier(myclass; C: CurveGen) returns BezierCurve from Geom2d
raises
NoSuchObject from Standard
---C++: inline
;
BSpline(myclass; C: HCurve2d from Adaptor2d) returns BSplineCurve from Geom2d
BSpline(myclass; C: CurveGen) returns BSplineCurve from Geom2d
raises
NoSuchObject from Standard
---C++: inline
@@ -228,7 +228,7 @@ is
NbSamples(myclass; C: HCurve2d from Adaptor2d; U0,U1: Real from Standard)
NbSamples(myclass; C: CurveGen; U0,U1: Real from Standard)
returns Integer from Standard;
end HCurve2dTool;
end HCurve2dToolGen;

View File

@@ -14,31 +14,37 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_HCurve2dTool.ixx>
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <TColStd_Array1OfReal.hxx>
//============================================================
Standard_Integer Contap_HCurve2dTool::NbSamples (const Handle(Adaptor2d_HCurve2d)& C,
const Standard_Real U0,
const Standard_Real U1)
Standard_Integer Contap_HCurve2dToolGen::NbSamples (const CurveGen& C,
const Standard_Real U0,
const Standard_Real U1)
{
Standard_Real nbs = 10.0;
switch (C->GetType())
{
case GeomAbs_Line:
nbs = 2.;
break;
case GeomAbs_BezierCurve:
nbs = 3. + C->NbPoles();
break;
case GeomAbs_BSplineCurve:
nbs = C->NbKnots();
nbs*= C->Degree();
nbs*= C->LastParameter()- C->FirstParameter();
nbs/= U1-U0;
if(nbs < 2.0) nbs = 2.;
break;
default:
break;
case GeomAbs_Line:
nbs = 2.;
break;
case GeomAbs_BezierCurve:
nbs = 3. + C->NbPoles();
break;
case GeomAbs_BSplineCurve:
nbs = C->NbKnots();
nbs*= C->Degree();
nbs*= C->LastParameter()- C->FirstParameter();
nbs/= U1-U0;
if(nbs < 2.0) nbs = 2.;
break;
default:
break;
}
if (nbs>50.)
nbs = 50.;

View File

@@ -14,7 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Adaptor2d_HCurve2d.hxx>
#include CurveGen_hxx
#include <GeomAbs_CurveType.hxx>
#include <GeomAbs_Shape.hxx>
@@ -33,59 +33,59 @@
#include <TColStd_Array1OfReal.hxx>
//============================================================
inline Standard_Real Contap_HCurve2dTool::FirstParameter (const Handle(Adaptor2d_HCurve2d)& C) {
inline Standard_Real Contap_HCurve2dToolGen::FirstParameter (const CurveGen& C) {
return(C->FirstParameter());
}
//============================================================
inline Standard_Real Contap_HCurve2dTool::LastParameter (const Handle(Adaptor2d_HCurve2d)& C) {
inline Standard_Real Contap_HCurve2dToolGen::LastParameter (const CurveGen& C) {
return(C->LastParameter());
}
//============================================================
inline GeomAbs_Shape Contap_HCurve2dTool::Continuity (const Handle(Adaptor2d_HCurve2d)& C) {
inline GeomAbs_Shape Contap_HCurve2dToolGen::Continuity (const CurveGen& C) {
return(C->Continuity());
}
//============================================================
inline Standard_Integer Contap_HCurve2dTool::NbIntervals(const Handle(Adaptor2d_HCurve2d)& C,const GeomAbs_Shape Sh) {
inline Standard_Integer Contap_HCurve2dToolGen::NbIntervals(const CurveGen& C,const GeomAbs_Shape Sh) {
return(C->NbIntervals(Sh));
}
//============================================================
inline void Contap_HCurve2dTool::Intervals(const Handle(Adaptor2d_HCurve2d)& C,
inline void Contap_HCurve2dToolGen::Intervals(const CurveGen& C,
TColStd_Array1OfReal& Tab,
const GeomAbs_Shape Sh) {
C->Intervals(Tab,Sh);
}
//============================================================
inline Standard_Boolean Contap_HCurve2dTool::IsClosed(const Handle(Adaptor2d_HCurve2d)& C) {
inline Standard_Boolean Contap_HCurve2dToolGen::IsClosed(const CurveGen& C) {
return(C->IsClosed());
}
//============================================================
inline Standard_Boolean Contap_HCurve2dTool::IsPeriodic(const Handle(Adaptor2d_HCurve2d)& C) {
inline Standard_Boolean Contap_HCurve2dToolGen::IsPeriodic(const CurveGen& C) {
return(C->IsPeriodic());
}
//============================================================
inline Standard_Real Contap_HCurve2dTool::Period(const Handle(Adaptor2d_HCurve2d)& C) {
inline Standard_Real Contap_HCurve2dToolGen::Period(const CurveGen& C) {
return(C->Period());
}
//============================================================
inline gp_Pnt2d Contap_HCurve2dTool::Value (const Handle(Adaptor2d_HCurve2d)& C,
inline gp_Pnt2d Contap_HCurve2dToolGen::Value (const CurveGen& C,
const Standard_Real U) {
return(C->Value(U));
}
//============================================================
inline void Contap_HCurve2dTool::D0(const Handle(Adaptor2d_HCurve2d)& C,
inline void Contap_HCurve2dToolGen::D0(const CurveGen& C,
const Standard_Real U,
gp_Pnt2d& P) {
C->D0(U,P);
}
//============================================================
inline void Contap_HCurve2dTool::D1 (const Handle(Adaptor2d_HCurve2d)& C,
inline void Contap_HCurve2dToolGen::D1 (const CurveGen& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T) {
C->D1(U,P,T);
}
//============================================================
inline void Contap_HCurve2dTool::D2 (const Handle(Adaptor2d_HCurve2d)& C,
inline void Contap_HCurve2dToolGen::D2 (const CurveGen& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& T,
@@ -94,7 +94,7 @@ inline void Contap_HCurve2dTool::D2 (const Handle(Adaptor2d_HCurve2d)& C,
C->D2(U,P,T,N);
}
//============================================================
inline void Contap_HCurve2dTool::D3 (const Handle(Adaptor2d_HCurve2d)& C,
inline void Contap_HCurve2dToolGen::D3 (const CurveGen& C,
const Standard_Real U,
gp_Pnt2d& P,
gp_Vec2d& V1,
@@ -104,47 +104,47 @@ inline void Contap_HCurve2dTool::D3 (const Handle(Adaptor2d_HCurve2d)& C,
C->D3(U,P,V1,V2,V3);
}
//============================================================
inline gp_Vec2d Contap_HCurve2dTool::DN (const Handle(Adaptor2d_HCurve2d)& C,
inline gp_Vec2d Contap_HCurve2dToolGen::DN (const CurveGen& C,
const Standard_Real U,
const Standard_Integer N) {
return(C->DN(U,N));
}
//============================================================
inline Standard_Real Contap_HCurve2dTool::Resolution(const Handle(Adaptor2d_HCurve2d)& C,
inline Standard_Real Contap_HCurve2dToolGen::Resolution(const CurveGen& C,
const Standard_Real R3d) {
return(C->Resolution(R3d));
}
//============================================================
inline GeomAbs_CurveType Contap_HCurve2dTool::GetType(const Handle(Adaptor2d_HCurve2d)& C) {
inline GeomAbs_CurveType Contap_HCurve2dToolGen::GetType(const CurveGen& C) {
return(C->GetType());
}
//============================================================
inline gp_Lin2d Contap_HCurve2dTool::Line (const Handle(Adaptor2d_HCurve2d)& C) {
inline gp_Lin2d Contap_HCurve2dToolGen::Line (const CurveGen& C) {
return(C->Line());
}
//============================================================
inline gp_Circ2d Contap_HCurve2dTool::Circle (const Handle(Adaptor2d_HCurve2d)& C) {
inline gp_Circ2d Contap_HCurve2dToolGen::Circle (const CurveGen& C) {
return(C->Circle());
}
//============================================================
inline gp_Elips2d Contap_HCurve2dTool::Ellipse (const Handle(Adaptor2d_HCurve2d)& C) {
inline gp_Elips2d Contap_HCurve2dToolGen::Ellipse (const CurveGen& C) {
return(C->Ellipse());
}
//============================================================
inline gp_Parab2d Contap_HCurve2dTool::Parabola (const Handle(Adaptor2d_HCurve2d)& C) {
inline gp_Parab2d Contap_HCurve2dToolGen::Parabola (const CurveGen& C) {
return(C->Parabola());
}
//============================================================
inline gp_Hypr2d Contap_HCurve2dTool::Hyperbola (const Handle(Adaptor2d_HCurve2d)& C) {
inline gp_Hypr2d Contap_HCurve2dToolGen::Hyperbola (const CurveGen& C) {
return(C->Hyperbola());
}
//============================================================
inline Handle(Geom2d_BezierCurve) Contap_HCurve2dTool::Bezier (const Handle(Adaptor2d_HCurve2d)& C) {
inline Handle(Geom2d_BezierCurve) Contap_HCurve2dToolGen::Bezier (const CurveGen& C) {
return(C->Bezier());
}
//============================================================
inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dTool::BSpline (const Handle(Adaptor2d_HCurve2d)& C) {
inline Handle(Geom2d_BSplineCurve) Contap_HCurve2dToolGen::BSpline (const CurveGen& C) {
return(C->BSpline());
}
//============================================================

View File

@@ -14,7 +14,12 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Line from Contap
generic class Line from Contap
(TheVertex as any;
TheArc as any;
ThePoint as any; --as Point from Contap(TheVertex,TheArc)
TheHSequenceOfPoint as Transient) --as HSequence from TCollection
-- (ThePoint)
---Purpose:
@@ -25,11 +30,7 @@ uses Pnt from gp,
Lin from gp,
Circ from gp,
Dir from gp,
IType from Contap, -- duplique IntPatch_IType. Mettre ds IntSurf
HVertex from Adaptor3d,
HCurve2d from Adaptor2d,
Point from Contap,
TheHSequenceOfPoint from Contap
IType from Contap -- duplique IntPatch_IType. Mettre ds IntSurf
raises DomainError from Standard,
OutOfRange from Standard
@@ -75,12 +76,12 @@ is
is static;
SetValue(me: in out; A: HCurve2d from Adaptor2d)
SetValue(me: in out; A: TheArc)
is static;
Add(me: in out; P: Point from Contap)
Add(me: in out; P: ThePoint)
is static;
@@ -95,7 +96,7 @@ is
Vertex(me; Index: Integer from Standard)
returns Point from Contap
returns ThePoint
---C++: return &
---C++: inline
@@ -170,7 +171,7 @@ is
Arc(me)
returns any HCurve2d from Adaptor2d
returns any TheArc
---C++: return const&
raises DomainError from Standard
@@ -202,8 +203,8 @@ fields
Trans : TypeTrans from IntSurf;
curv : LineOn2S from IntSurf;
svtx : TheHSequenceOfPoint from Contap;
thearc : HCurve2d from Adaptor2d;
svtx : TheHSequenceOfPoint;
thearc : TheArc;
typL : IType from Contap;
pt : Pnt from gp;
dir1 : Dir from gp;

View File

@@ -14,18 +14,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_Line.ixx>
Contap_Line::Contap_Line () {
svtx = new Contap_TheHSequenceOfPoint ();
svtx = new TheHSequenceOfPoint ();
Trans = IntSurf_Undecided;
}
void Contap_Line::ResetSeqOfVertex() {
svtx = new Contap_TheHSequenceOfPoint ();
svtx = new TheHSequenceOfPoint ();
}
void Contap_Line::Add(const Contap_Point& P) {
void Contap_Line::Add(const ThePoint& P) {
Standard_Integer n = svtx->Length();
if(n==0) {
svtx->Append(P);
@@ -37,10 +35,10 @@ void Contap_Line::Add(const Contap_Point& P) {
}
else {
for(Standard_Integer i=n-1;i>0;i--) {
if(prm> svtx->Value(i).ParameterOnLine()) {
svtx->InsertBefore(i+1,P);
return;
}
if(prm> svtx->Value(i).ParameterOnLine()) {
svtx->InsertBefore(i+1,P);
return;
}
}
svtx->Prepend(P);
}
@@ -50,7 +48,7 @@ void Contap_Line::Add(const Contap_Point& P) {
void Contap_Line::Clear () {
if(!curv.IsNull())
curv->Clear();
svtx = new Contap_TheHSequenceOfPoint ();
svtx = new TheHSequenceOfPoint ();
typL = Contap_Walking;
}
@@ -70,7 +68,7 @@ void Contap_Line::SetValue(const gp_Circ& C)
typL = Contap_Circle;
}
void Contap_Line::SetValue(const Handle(Adaptor2d_HCurve2d)& A)
void Contap_Line::SetValue(const TheArc& A)
{
thearc = A;
typL = Contap_Restriction;
@@ -89,7 +87,7 @@ IntSurf_TypeTrans Contap_Line::TransitionOnS() const {
return(Trans);
}
const Handle(Adaptor2d_HCurve2d)& Contap_Line::Arc () const
const TheArc& Contap_Line::Arc () const
{
if (typL != Contap_Restriction) {Standard_DomainError::Raise();}
return thearc;

View File

@@ -21,8 +21,7 @@
#include <IntSurf_PntOn2S.hxx>
#include <IntSurf_LineOn2S.hxx>
#include <Contap_Point.hxx>
#include <Contap_TheHSequenceOfPoint.hxx>
#include TheHSequenceOfPoint_hxx
inline const Handle(IntSurf_LineOn2S)& Contap_Line::LineOn2S () const
{
@@ -39,7 +38,7 @@ inline Standard_Integer Contap_Line::NbVertex () const
return svtx->Length();
}
inline Contap_Point& Contap_Line::Vertex (const Standard_Integer Index) const
inline ThePoint& Contap_Line::Vertex (const Standard_Integer Index) const
{
return svtx->ChangeSequence()(Index);
}

View File

@@ -14,7 +14,9 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Point from Contap
generic class Point from Contap
(TheVertex as any;
TheArc as any)
---Purpose: Definition of a vertex on the contour line.
@@ -26,9 +28,7 @@ class Point from Contap
uses Pnt from gp,
Transition from IntSurf,
HVertex from Adaptor3d,
HCurve2d from Adaptor2d
Transition from IntSurf
raises DomainError from Standard
@@ -68,7 +68,7 @@ is
is static;
SetVertex(me: in out; V: HVertex from Adaptor3d)
SetVertex(me: in out; V: TheVertex)
---Purpose: Sets the values of a point which is a vertex on
-- the initial facet of restriction of one
@@ -79,7 +79,7 @@ is
is static;
SetArc(me: in out; A: HCurve2d from Adaptor2d; Param: Real from Standard;
SetArc(me: in out; A: TheArc; Param: Real from Standard;
TLine,TArc: Transition from IntSurf)
---Purpose: Sets the value of the arc and of the parameter on
@@ -151,7 +151,7 @@ is
---Purpose: Returns the arc of restriction containing the
-- vertex.
returns any HCurve2d from Adaptor2d
returns any TheArc
---C++: return const&
---C++: inline
@@ -221,7 +221,7 @@ is
-- IsVertex returns True.
-- Otherwise, an exception is raised.
returns any HVertex from Adaptor3d
returns any TheVertex
---C++: return const&
---C++: inline
@@ -259,12 +259,12 @@ fields
vparam : Real from Standard;
paraline : Real from Standard;
onarc : Boolean from Standard;
arc : HCurve2d from Adaptor2d;
arc : TheArc;
traline : Transition from IntSurf;
traarc : Transition from IntSurf;
prmarc : Real from Standard;
isvtx : Boolean from Standard;
vtx : HVertex from Adaptor3d;
vtx : TheVertex;
ismult : Boolean from Standard;
myInternal : Boolean from Standard;

View File

@@ -14,16 +14,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_Point.ixx>
Contap_Point::Contap_Point ():
onarc(Standard_False),isvtx(Standard_False),ismult(Standard_False),
myInternal(Standard_False)
onarc(Standard_False),isvtx(Standard_False),ismult(Standard_False),
myInternal(Standard_False)
{}
Contap_Point::Contap_Point (const gp_Pnt& Pt,
const Standard_Real U,
const Standard_Real V):
pt(Pt),uparam(U),vparam(V),onarc(Standard_False),isvtx(Standard_False),
ismult(Standard_False),myInternal(Standard_False)
const Standard_Real U,
const Standard_Real V):
pt(Pt),uparam(U),vparam(V),onarc(Standard_False),isvtx(Standard_False),
ismult(Standard_False),myInternal(Standard_False)
{}

View File

@@ -34,13 +34,13 @@ inline void Contap_Point::SetParameter (const Standard_Real Para) {
paraline = Para;
}
inline void Contap_Point::SetVertex(const Handle(Adaptor3d_HVertex)& V) {
inline void Contap_Point::SetVertex(const TheVertex& V) {
isvtx = Standard_True;
vtx = V;
}
inline void Contap_Point::SetArc (const Handle(Adaptor2d_HCurve2d)& A,
inline void Contap_Point::SetArc (const TheArc& A,
const Standard_Real Param,
const IntSurf_Transition& TLine,
const IntSurf_Transition& TArc) {
@@ -94,7 +94,7 @@ inline Standard_Boolean Contap_Point::IsOnArc () const{
return onarc;
}
inline const Handle_Adaptor2d_HCurve2d& Contap_Point::Arc () const {
inline const TheArc& Contap_Point::Arc () const {
if (!onarc) {Standard_DomainError::Raise();}
return arc;
@@ -122,7 +122,7 @@ inline Standard_Boolean Contap_Point::IsVertex () const {
return isvtx;
}
inline const Handle_Adaptor3d_HVertex& Contap_Point::Vertex () const {
inline const TheVertex& Contap_Point::Vertex () const {
if (!isvtx) {Standard_DomainError::Raise();}
return vtx;

View File

@@ -14,23 +14,27 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class SurfFunction from Contap inherits FunctionSetWithDerivatives from math
generic class SurfFunction from Contap
(TheSurface as any;
TheSurfaceTool as any;
TheSurfProps as any; -- as SurfProps from Contap(TheSurface,
-- TheSurfaceTool)
TheContTool as any)
inherits FunctionSetWithDerivatives from math
---Purpose: This class describes the function on a parametric surface.
-- the form of the function is F(u,v) = 0 where u and v are
-- the parameteric coordinates of a point on the surface,
-- to compute the contours of the surface.
uses Vector from math,
Matrix from math,
Pnt from gp,
Vec from gp,
Dir from gp,
Dir2d from gp,
TFunction from Contap,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d,
HContTool from Contap
uses Vector from math,
Matrix from math,
Pnt from gp,
Vec from gp,
Dir from gp,
Dir2d from gp,
TFunction from Contap
raises UndefinedDerivative from StdFail
@@ -42,7 +46,7 @@ is
returns SurfFunction from Contap;
Set(me: in out; S: HSurface from Adaptor3d)
Set(me: in out; S: TheSurface)
is static;
@@ -199,7 +203,7 @@ is
Surface(me)
returns any HSurface from Adaptor3d
returns any TheSurface
---C++: return const&
---C++: inline
is static;
@@ -208,7 +212,7 @@ is
fields
mySurf : HSurface from Adaptor3d;
mySurf : TheSurface;
myMean : Real from Standard;
myType : TFunction from Contap;
myDir : Dir from gp;

View File

@@ -16,36 +16,34 @@
// jag 940616 #define Tolpetit 1.e-16
#include <Contap_SurfFunction.ixx>
#include <Contap_SurfProps.hxx>
#include <Contap_HContTool.hxx>
#include <Adaptor3d_HSurfaceTool.hxx>
#include <gp.hxx>
Contap_SurfFunction::Contap_SurfFunction ():
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.),
myCosAng(0.), // PI/2 - Angle de depouille
tol(1.e-6),
computed(Standard_False),
derived(Standard_False)
myMean(1.),
myType(Contap_ContourStd),
myDir(0.,0.,1.),
myCosAng(0.), // PI/2 - Angle de depouille
tol(1.e-6),
computed(Standard_False),
derived(Standard_False)
{}
void Contap_SurfFunction::Set(const Handle(Adaptor3d_HSurface)& S)
void Contap_SurfFunction::Set(const TheSurface& S)
{
mySurf = S;
Standard_Integer i;
Standard_Integer nbs = Contap_HContTool::NbSamplePoints(S);
Standard_Integer nbs = TheContTool::NbSamplePoints(S);
Standard_Real U,V;
gp_Vec norm;
if (nbs > 0) {
myMean = 0.;
for (i = 1; i <= nbs; i++) {
Contap_HContTool::SamplePoint(S,i,U,V);
// Adaptor3d_HSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
Contap_SurfProps::Normale(S,U,V,solpt,norm);
TheContTool::SamplePoint(S,i,U,V);
// TheSurfaceTool::D1(S,U,V,solpt,d1u,d1v);
// myMean = myMean + d1u.Crossed(d1v).Magnitude();
TheSurfProps::Normale(S,U,V,solpt,norm);
myMean = myMean + norm.Magnitude();
}
myMean = myMean / ((Standard_Real)nbs);
@@ -67,13 +65,13 @@ Standard_Integer Contap_SurfFunction::NbEquations () const
Standard_Boolean Contap_SurfFunction::Value(const math_Vector& X,
math_Vector& F)
math_Vector& F)
{
Usol = X(1); Vsol = X(2);
// Adaptor3d_HSurfaceTool::D1(mySurf,Usol,Vsol,solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
// TheSurfaceTool::D1(mySurf,Usol,Vsol,solpt,d1u,d1v);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm;
Contap_SurfProps::Normale(mySurf,Usol,Vsol,solpt,norm);
TheSurfProps::Normale(mySurf,Usol,Vsol,solpt,norm);
switch (myType) {
case Contap_ContourStd:
{
@@ -101,20 +99,20 @@ Standard_Boolean Contap_SurfFunction::Value(const math_Vector& X,
Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
math_Matrix& Grad)
math_Matrix& Grad)
{
// gp_Vec d2u,d2v,d2uv;
// gp_Vec d2u,d2v,d2uv;
Usol = X(1); Vsol = X(2);
// Adaptor3d_HSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
// TheSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
gp_Vec norm,dnu,dnv;
Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Grad(1,1) = (dnu.Dot(myDir))/myMean;
Grad(1,2) = (dnv.Dot(myDir))/myMean;
}
@@ -128,11 +126,11 @@ Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
break;
case Contap_DraftStd:
{
// gp_Vec norm(d1u.Crossed(d1v).Normalized());
// gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
// Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
// dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
// Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
// gp_Vec norm(d1u.Crossed(d1v).Normalized());
// gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
// Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
// dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
// Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
norm.Normalize();
Grad(1,1) = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Grad(1,2) = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
@@ -151,24 +149,24 @@ Standard_Boolean Contap_SurfFunction::Derivatives(const math_Vector& X,
Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
math_Vector& F,
math_Matrix& Grad)
math_Vector& F,
math_Matrix& Grad)
{
// gp_Vec d2u,d2v,d2uv;
// gp_Vec d2u,d2v,d2uv;
Usol = X(1); Vsol = X(2);
// Adaptor3d_HSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
// TheSurfaceTool::D2(mySurf,Usol,Vsol,solpt,d1u,d1v,d2u,d2v,d2uv);
// gp_Vec norm(d1u.Crossed(d1v));
gp_Vec norm,dnu,dnv;
Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
F(1) = (norm.Dot(myDir))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Grad(1,1) = (dnu.Dot(myDir))/myMean;
Grad(1,2) = (dnv.Dot(myDir))/myMean;
}
@@ -177,8 +175,8 @@ Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
{
gp_Vec Ep(myEye,solpt);
F(1) = (norm.Dot(Ep))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
// Grad(1,1) = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Grad(1,2) = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
Grad(1,1) = (dnu.Dot(Ep))/myMean;
Grad(1,2) = (dnv.Dot(Ep))/myMean;
}
@@ -187,12 +185,12 @@ Standard_Boolean Contap_SurfFunction::Values (const math_Vector& X,
{
F(1) = (norm.Dot(myDir)-myCosAng*norm.Magnitude())/myMean;
norm.Normalize();
/*
/*
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
Grad(1,1) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
Grad(1,2) = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
*/
Grad(1,1) = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Grad(1,2) = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
@@ -215,47 +213,47 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
if (!computed) {
computed = Standard_True;
if(!derived) {
// gp_Vec d2u,d2v,d2uv;
// Adaptor3d_HSurfaceTool::D2(mySurf, Usol, Vsol, solpt, d1u, d1v, d2u, d2v, d2uv);
// gp_Vec d2u,d2v,d2uv;
// TheSurfaceTool::D2(mySurf, Usol, Vsol, solpt, d1u, d1v, d2u, d2v, d2uv);
gp_Vec norm,dnu,dnv;
Contap_SurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
TheSurfProps::NormAndDn(mySurf,Usol,Vsol,solpt,norm,dnu,dnv);
switch (myType) {
case Contap_ContourStd:
{
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Fpu = (dnu.Dot(myDir))/myMean;
Fpv = (dnv.Dot(myDir))/myMean;
}
break;
{
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(myDir))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(myDir))/myMean;
Fpu = (dnu.Dot(myDir))/myMean;
Fpv = (dnv.Dot(myDir))/myMean;
}
break;
case Contap_ContourPrs:
{
gp_Vec Ep(myEye,solpt);
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
Fpu = (dnu.Dot(Ep))/myMean;
Fpv = (dnv.Dot(Ep))/myMean;
}
break;
{
gp_Vec Ep(myEye,solpt);
// Fpu = ((d2u.Crossed(d1v) + d1u.Crossed(d2uv)).Dot(Ep))/myMean;
// Fpv = ((d2uv.Crossed(d1v) + d1u.Crossed(d2v)).Dot(Ep))/myMean;
Fpu = (dnu.Dot(Ep))/myMean;
Fpv = (dnv.Dot(Ep))/myMean;
}
break;
case Contap_DraftStd:
{
/*
gp_Vec norm(d1u.Crossed(d1v).Normalized());
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
Fpu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
Fpv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
norm.Normalize();
Fpu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Fpv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
break;
{
/*
gp_Vec norm(d1u.Crossed(d1v).Normalized());
gp_Vec dnorm(d2u.Crossed(d1v) + d1u.Crossed(d2uv));
Fpu = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
dnorm = d2uv.Crossed(d1v) + d1u.Crossed(d2v);
Fpv = (dnorm.Dot(myDir)-myCosAng*dnorm.Dot(norm))/myMean;
*/
norm.Normalize();
Fpu = (dnu.Dot(myDir)-myCosAng*dnu.Dot(norm))/myMean;
Fpv = (dnv.Dot(myDir)-myCosAng*dnv.Dot(norm))/myMean;
}
break;
case Contap_DraftPrs:
default:
{
}
{
}
}
derived = Standard_True;
}
@@ -268,15 +266,15 @@ Standard_Boolean Contap_SurfFunction::IsTangent ()
else {
d2d = gp_Dir2d(-Fpv,Fpu);
gp_Vec d1u,d1v;
Adaptor3d_HSurfaceTool::D1(mySurf, Usol, Vsol, solpt, d1u, d1v); // ajout jag 02.95
TheSurfaceTool::D1(mySurf, Usol, Vsol, solpt, d1u, d1v); // ajout jag 02.95
gp_XYZ d3dxyz(-Fpv*d1u.XYZ());
d3dxyz.Add(Fpu*d1v.XYZ());
d3d.SetXYZ(d3dxyz);
//jag 940616 if (d3d.Magnitude() <= Tolpetit) {
if (d3d.Magnitude() <= tol) {
tangent = Standard_True;
tangent = Standard_True;
}
}
}

View File

@@ -80,7 +80,7 @@ inline const gp_Dir2d& Contap_SurfFunction::Direction2d()
return d2d;
}
inline const Handle_Adaptor3d_HSurface& Contap_SurfFunction::Surface() const
inline const TheSurface& Contap_SurfFunction::Surface() const
{
return mySurf;
}

View File

@@ -14,19 +14,19 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class SurfProps from Contap
generic class SurfProps from Contap
(TheSurface as any;
TheSurfaceTool as any)
---Purpose: Internal tool used to compute the normal and its
-- derivatives.
uses Pnt from gp,
Vec from gp,
HSurface from Adaptor3d,
HSurfaceTool from Adaptor3d
uses Pnt from gp,
Vec from gp
is
Normale(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
Normale(myclass; S: TheSurface; U,V: Real from Standard;
P: out Pnt from gp;
N: out Vec from gp);
@@ -35,7 +35,7 @@ is
DerivAndNorm(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
DerivAndNorm(myclass; S: TheSurface; U,V: Real from Standard;
P : out Pnt from gp;
d1u,d1v: out Vec from gp;
N : out Vec from gp);
@@ -45,7 +45,7 @@ is
NormAndDn(myclass; S: HSurface from Adaptor3d; U,V: Real from Standard;
NormAndDn(myclass; S: TheSurface; U,V: Real from Standard;
P : out Pnt from gp;
N,Dnu,Dnv: out Vec from gp);

View File

@@ -14,32 +14,29 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Contap_SurfProps.ixx>
#include <ElSLib.hxx>
#include <Adaptor3d_HSurfaceTool.hxx>
//=======================================================================
//function : Normale
//purpose :
//=======================================================================
void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm)
void Contap_SurfProps::Normale(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm)
{
GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
gp_Pln pl(TheSurfaceTool::Plane(S));
Norm = pl.Axis().Direction();
P = ElSLib::Value(U,V,pl);
if (!pl.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@@ -47,26 +44,26 @@ void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Sphere:
{
gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
gp_Sphere sp(TheSurfaceTool::Sphere(S));
P = ElSLib::Value(U,V,sp);
Norm = gp_Vec(sp.Location(),P);
if (sp.Direct()) {
Norm.Divide(sp.Radius());
Norm.Divide(sp.Radius());
}
else {
Norm.Divide(-sp.Radius());
Norm.Divide(-sp.Radius());
}
}
break;
case GeomAbs_Cylinder:
{
gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
P = ElSLib::Value(U,V,cy);
Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
Sin(U),cy.YAxis().Direction());
Sin(U),cy.YAxis().Direction());
if (!cy.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@@ -74,7 +71,7 @@ void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Cone:
{
gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
gp_Cone co(TheSurfaceTool::Cone(S));
P = ElSLib::Value(U,V,co);
Standard_Real Angle = co.SemiAngle();
Standard_Real Sina = sin(Angle);
@@ -83,38 +80,38 @@ void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S,
Standard_Real Vcalc = V;
if (Abs(V*Sina + Rad) <= 1e-12) { // on est a l`apex
/*
Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
*/
Norm.SetCoord(0,0,0);
return;
/*
Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
*/
Norm.SetCoord(0,0,0);
return;
}
if (Rad + Vcalc*Sina < 0.) {
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
}
else {
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*cos(U),co.XAxis().Direction(),
Cosa*sin(U),co.YAxis().Direction());
}
if (!co.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
default:
{
gp_Vec d1u,d1v;
Adaptor3d_HSurfaceTool::D1(S,U,V,P,d1u,d1v);
TheSurfaceTool::D1(S,U,V,P,d1u,d1v);
Norm = d1u.Crossed(d1v);
}
break;
@@ -129,24 +126,24 @@ void Contap_SurfProps::Normale(const Handle(Adaptor3d_HSurface)& S,
//purpose :
//=======================================================================
void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& d1u,
gp_Vec& d1v,
gp_Vec& Norm)
void Contap_SurfProps::DerivAndNorm(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& d1u,
gp_Vec& d1v,
gp_Vec& Norm)
{
GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
gp_Pln pl(TheSurfaceTool::Plane(S));
Norm = pl.Axis().Direction();
ElSLib::D1(U,V,pl,P,d1u,d1v);
if (!pl.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@@ -154,26 +151,26 @@ void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Sphere:
{
gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
gp_Sphere sp(TheSurfaceTool::Sphere(S));
ElSLib::D1(U,V,sp,P,d1u,d1v);
Norm = gp_Vec(sp.Location(),P);
if (sp.Direct()) {
Norm.Divide(sp.Radius());
Norm.Divide(sp.Radius());
}
else {
Norm.Divide(-sp.Radius());
Norm.Divide(-sp.Radius());
}
}
break;
case GeomAbs_Cylinder:
{
gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
ElSLib::D1(U,V,cy,P,d1u,d1v);
Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
Sin(U),cy.YAxis().Direction());
Sin(U),cy.YAxis().Direction());
if (!cy.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
@@ -181,7 +178,7 @@ void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Cone:
{
gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
gp_Cone co(TheSurfaceTool::Cone(S));
ElSLib::D1(U,V,co,P,d1u,d1v);
Standard_Real Angle = co.SemiAngle();
Standard_Real Sina = Sin(Angle);
@@ -190,33 +187,33 @@ void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S,
Standard_Real Vcalc = V;
if (Abs(V*Sina + Rad) <= RealEpsilon()) { // on est a l`apex
Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
}
if (Rad + Vcalc*Sina < 0.) {
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
else {
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
if (!co.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
}
break;
default:
{
Adaptor3d_HSurfaceTool::D1(S,U,V,P,d1u,d1v);
TheSurfaceTool::D1(S,U,V,P,d1u,d1v);
Norm = d1u.Crossed(d1v);
}
break;
@@ -229,24 +226,24 @@ void Contap_SurfProps::DerivAndNorm(const Handle(Adaptor3d_HSurface)& S,
//purpose :
//=======================================================================
void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm,
gp_Vec& Dnu,
gp_Vec& Dnv)
void Contap_SurfProps::NormAndDn(const TheSurface& S,
const Standard_Real U,
const Standard_Real V,
gp_Pnt& P,
gp_Vec& Norm,
gp_Vec& Dnu,
gp_Vec& Dnv)
{
GeomAbs_SurfaceType typS = Adaptor3d_HSurfaceTool::GetType(S);
GeomAbs_SurfaceType typS = TheSurfaceTool::GetType(S);
switch (typS) {
case GeomAbs_Plane:
{
gp_Pln pl(Adaptor3d_HSurfaceTool::Plane(S));
gp_Pln pl(TheSurfaceTool::Plane(S));
P = ElSLib::Value(U,V,pl);
Norm = pl.Axis().Direction();
if (!pl.Direct()) {
Norm.Reverse();
Norm.Reverse();
}
Dnu = Dnv = gp_Vec(0.,0.,0.);
}
@@ -254,12 +251,12 @@ void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Sphere:
{
gp_Sphere sp(Adaptor3d_HSurfaceTool::Sphere(S));
gp_Sphere sp(TheSurfaceTool::Sphere(S));
ElSLib::D1(U,V,sp,P,Dnu,Dnv);
Norm = gp_Vec(sp.Location(),P);
Standard_Real Rad = sp.Radius();
if (!sp.Direct()) {
Rad = -Rad;
Rad = -Rad;
}
Norm.Divide(Rad);
Dnu.Divide(Rad);
@@ -269,15 +266,15 @@ void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Cylinder:
{
gp_Cylinder cy(Adaptor3d_HSurfaceTool::Cylinder(S));
gp_Cylinder cy(TheSurfaceTool::Cylinder(S));
P = ElSLib::Value(U,V,cy);
Norm.SetLinearForm(Cos(U),cy.XAxis().Direction(),
Sin(U),cy.YAxis().Direction());
Sin(U),cy.YAxis().Direction());
Dnu.SetLinearForm(-Sin(U),cy.XAxis().Direction(),
Cos(U),cy.YAxis().Direction());
Cos(U),cy.YAxis().Direction());
if (!cy.Direct()) {
Norm.Reverse();
Dnu.Reverse();
Norm.Reverse();
Dnu.Reverse();
}
Dnv = gp_Vec(0.,0.,0.);
}
@@ -286,7 +283,7 @@ void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S,
case GeomAbs_Cone:
{
gp_Cone co(Adaptor3d_HSurfaceTool::Cone(S));
gp_Cone co(TheSurfaceTool::Cone(S));
P = ElSLib::Value(U,V,co);
Standard_Real Angle = co.SemiAngle();
Standard_Real Sina = Sin(Angle);
@@ -294,39 +291,39 @@ void Contap_SurfProps::NormAndDn(const Handle(Adaptor3d_HSurface)& S,
Standard_Real Rad = co.RefRadius();
Standard_Real Vcalc = V;
if (Abs(V*Sina + Rad) <= RealEpsilon()) { // on est a l`apex
Standard_Real Vfi = Adaptor3d_HSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
Standard_Real Vfi = TheSurfaceTool::FirstVParameter(S);
if (Vfi < -Rad/Sina) { // partie valide pour V < Vapex
Vcalc = V - 1;
}
else {
Vcalc = V + 1.;
}
}
if (Rad + Vcalc*Sina < 0.) {
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
else {
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
Norm.SetLinearForm(-Sina, co.Axis().Direction(),
Cosa*Cos(U),co.XAxis().Direction(),
Cosa*Sin(U),co.YAxis().Direction());
}
Dnu.SetLinearForm(-Cosa*Sin(U),co.XAxis().Direction(),
Cosa*Cos(U),co.YAxis().Direction());
Cosa*Cos(U),co.YAxis().Direction());
if (!co.Direct()) {
Norm.Reverse();
Dnu.Reverse();
Norm.Reverse();
Dnu.Reverse();
}
Dnv = gp_Vec(0.,0.,0.);
}
break;
default:
{
gp_Vec d1u,d1v,d2u,d2v,d2uv;
Adaptor3d_HSurfaceTool::D2(S,U,V,P,d1u,d1v,d2u,d2v,d2uv);
TheSurfaceTool::D2(S,U,V,P,d1u,d1v,d2u,d2v,d2uv);
Norm = d1u.Crossed(d1v);
Dnu = d2u.Crossed(d1v) + d1u.Crossed(d2uv);
Dnv = d2uv.Crossed(d1v) + d1u.Crossed(d2v);

3
src/Contap/FILES Executable file
View File

@@ -0,0 +1,3 @@
Contap_ContourGen_1.gxx
Contap_ContourGen_2.gxx
Contap_ContourGen_3.gxx

View File

@@ -125,96 +125,11 @@ is
-- Curve-Curve:
-- 3d:
class ExtCC;
class CCache instantiates CurveCache from Extrema
(Curve from Adaptor3d,
Pnt from gp,
HArray1OfPnt from TColgp);
class ECC instantiates GenExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
Curve from Adaptor3d,
CurveTool from Extrema,
CCache from Extrema,
HArray1OfPnt from TColgp,
POnCurv from Extrema,
Pnt from gp,
Vec from gp);
class LocateExtCC;
class LCCache instantiates CurveCache from Extrema
(Curve from Adaptor3d,
Pnt from gp,
HArray1OfPnt from TColgp);
class ELCC instantiates GenExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
Curve from Adaptor3d,
CurveTool from Extrema,
LCCache from Extrema,
HArray1OfPnt from TColgp,
POnCurv from Extrema,
Pnt from gp,
Vec from gp);
class LocECC instantiates GenLocateExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
Curve from Adaptor3d,
CurveTool from Extrema,
POnCurv from Extrema,
Pnt from gp,
Vec from gp);
generic class GExtCC, CCache, ECC;
generic class GLocateExtCC, LCCache, ELCC, LocECC;
-- 2d:
class ExtCC2d;
class CCache2d instantiates CurveCache from Extrema
(Curve2d from Adaptor2d,
Pnt2d from gp,
HArray1OfPnt2d from TColgp);
class ECC2d instantiates GenExtCC from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,
Curve2d from Adaptor2d,
Curve2dTool from Extrema,
CCache2d from Extrema,
HArray1OfPnt2d from TColgp,
POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp);
class LocateExtCC2d;
class LCCache2d instantiates CurveCache from Extrema
(Curve2d from Adaptor2d,
Pnt2d from gp,
HArray1OfPnt2d from TColgp);
class ELCC2d instantiates GenExtCC from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,
Curve2d from Adaptor2d,
Curve2dTool from Extrema,
LCCache2d from Extrema,
HArray1OfPnt2d from TColgp,
POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp);
class LocECC2d instantiates GenLocateExtCC from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,
Curve2d from Adaptor2d,
Curve2dTool from Extrema,
POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp);
generic class GExtCC2d, CCache2d, ECC2d;
generic class GLocateExtCC2d, LCCache2d, ELCC2d, LocECC2d;
-- Curve-Surface:
class ExtCS;
@@ -311,6 +226,20 @@ is
Vec from gp,
POnCurv from Extrema,
SequenceOfPOnCurv from Extrema);
class ExtCC instantiates GExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
Curve from Adaptor3d,
CurveTool from Extrema);
class LocateExtCC instantiates GLocateExtCC from Extrema
(Curve from Adaptor3d,
CurveTool from Extrema,
Curve from Adaptor3d,
CurveTool from Extrema);
--- 2d instantiations:
class ExtPC2d instantiates GExtPC from Extrema
@@ -331,6 +260,21 @@ is
Vec2d from gp,
POnCurv2d from Extrema,
SequenceOfPOnCurv2d from Extrema);
class ExtCC2d instantiates GExtCC2d from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,
Curve2d from Adaptor2d,
Curve2dTool from Extrema);
class LocateExtCC2d instantiates GLocateExtCC2d from Extrema
(Curve2d from Adaptor2d,
Curve2dTool from Extrema,
Curve2d from Adaptor2d,
Curve2dTool from Extrema);
end Extrema;

View File

@@ -14,10 +14,13 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ExtCC from Extrema
generic class GExtCC from Extrema (Curve1 as any;
Tool1 as any;
Curve2 as any;
Tool2 as any)
---Purpose: It calculates all the distance between two curves.
-- These distances can be maximum or minimum.
---Purpose: It calculates all the distance between two curves.
-- These distances can be maximum or minimum.
uses POnCurv from Extrema,
SequenceOfPOnCurv from Extrema,
@@ -25,42 +28,52 @@ uses POnCurv from Extrema,
Pnt from gp,
HArray1OfPnt from TColgp,
SequenceOfReal from TColStd,
ListOfTransient from TColStd,
Curve from Adaptor3d,
CurveTool from Extrema,
ECC from Extrema
ListOfTransient from TColStd
raises InfiniteSolutions from StdFail,
NotDone from StdFail,
OutOfRange from Standard
NotDone from StdFail,
OutOfRange from Standard
class CCache instantiates CurveCache from Extrema (Curve1, Pnt from gp, HArray1OfPnt from TColgp);
class ECC instantiates GenExtCC from Extrema
(Curve1,
Tool1,
Curve2,
Tool2,
CCache,
HArray1OfPnt from TColgp,
POnCurv,
Pnt,
Vec);
is
Create (TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns ExtCC;
Create (TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns GExtCC;
Create (C1: Curve from Adaptor3d; C2: Curve from Adaptor3d;
TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns ExtCC;
Create (C1: Curve1; C2: Curve2;
TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns GExtCC;
---Purpose: It calculates all the distances.
Create (C1: Curve from Adaptor3d;
C2: Curve from Adaptor3d;
Create (C1: Curve1;
C2: Curve2;
U1: Real from Standard;
U2: Real from Standard;
V1: Real from Standard;
V2: Real from Standard;
TolC1: Real = 1.0e-10;
TolC2: Real = 1.0e-10) returns ExtCC;
TolC2: Real = 1.0e-10) returns GExtCC;
---Purpose: It calculates all the distances.
SetCurve (me: in out; theRank: Integer; C: Curve from Adaptor3d);
SetCurve (me: in out; theRank: Integer; C: Curve1);
---Purpose:
SetCurve (me: in out; theRank: Integer; C: Curve from Adaptor3d; Uinf, Usup: Real);
SetCurve (me: in out; theRank: Integer; C: Curve1; Uinf, Usup: Real);
---Purpose:
SetRange (me: in out; theRank: Integer; Uinf, Usup: Real);
@@ -127,7 +140,7 @@ is
is static protected;
Results(me: in out;AlgExt: ECC from Extrema;
Results(me: in out;AlgExt: ECC;
Ut11, Ut12, Ut21, Ut22: Real)
is static protected;
@@ -159,4 +172,4 @@ fields
end ExtCC;
end GExtCC;

View File

@@ -19,7 +19,7 @@
// tri des solutions pour eviter de rendre plusieurs
// fois la meme solution
#include <Extrema_ExtCC.ixx>
#include Extrema_ECC_hxx
#include <StdFail_NotDone.hxx>
#include <Extrema_ExtElC.hxx>
@@ -43,16 +43,12 @@
#include <Extrema_ExtPElC.hxx>
#include <Standard_NullObject.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Extrema_CurveTool.hxx>
#include <Extrema_CCache.hxx>
//=======================================================================
//function : Extrema_ExtCC
//function : Extrema_GExtCC
//purpose :
//=======================================================================
Extrema_ExtCC::Extrema_ExtCC (const Standard_Real TolC1,
Extrema_GExtCC::Extrema_GExtCC (const Standard_Real TolC1,
const Standard_Real TolC2) :
myDone (Standard_False)
{
@@ -61,12 +57,12 @@ Extrema_ExtCC::Extrema_ExtCC (const Standard_Real TolC1,
}
//=======================================================================
//function : Extrema_ExtCC
//function : Extrema_GExtCC
//purpose :
//=======================================================================
Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1,
const Adaptor3d_Curve& C2,
Extrema_GExtCC::Extrema_GExtCC(const Curve1& C1,
const Curve2& C2,
const Standard_Real U1,
const Standard_Real U2,
const Standard_Real V1,
@@ -84,12 +80,12 @@ Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1,
//=======================================================================
//function : Extrema_ExtCC
//function : Extrema_GExtCC
//purpose :
//=======================================================================
Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1,
const Adaptor3d_Curve& C2,
Extrema_GExtCC::Extrema_GExtCC(const Curve1& C1,
const Curve2& C2,
const Standard_Real TolC1,
const Standard_Real TolC2) :
myDone (Standard_False)
@@ -106,9 +102,9 @@ Extrema_ExtCC::Extrema_ExtCC(const Adaptor3d_Curve& C1,
//purpose :
//=======================================================================
void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C)
void Extrema_GExtCC::SetCurve (const Standard_Integer theRank, const Curve1& C)
{
Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetCurve()")
Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_GExtCC::SetCurve()")
Standard_Integer anInd = theRank - 1;
myC[anInd] = (Standard_Address)&C;
@@ -121,7 +117,7 @@ void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Cu
//purpose :
//=======================================================================
void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Curve& C,
void Extrema_GExtCC::SetCurve (const Standard_Integer theRank, const Curve1& C,
const Standard_Real Uinf, const Standard_Real Usup)
{
SetCurve (theRank, C);
@@ -133,10 +129,10 @@ void Extrema_ExtCC::SetCurve (const Standard_Integer theRank, const Adaptor3d_Cu
//purpose :
//=======================================================================
void Extrema_ExtCC::SetRange (const Standard_Integer theRank,
void Extrema_GExtCC::SetRange (const Standard_Integer theRank,
const Standard_Real Uinf, const Standard_Real Usup)
{
Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetRange()")
Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_GExtCC::SetRange()")
Standard_Integer anInd = theRank - 1;
myInf[anInd] = Uinf;
mySup[anInd] = Usup;
@@ -147,9 +143,9 @@ void Extrema_ExtCC::SetRange (const Standard_Integer theRank,
//purpose :
//=======================================================================
void Extrema_ExtCC::SetTolerance (const Standard_Integer theRank, const Standard_Real theTol)
void Extrema_GExtCC::SetTolerance (const Standard_Integer theRank, const Standard_Real theTol)
{
Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_ExtCC::SetTolerance()")
Standard_OutOfRange_Raise_if (theRank < 1 || theRank > 2, "Extrema_GExtCC::SetTolerance()")
Standard_Integer anInd = theRank - 1;
myTol[anInd] = theTol;
}
@@ -160,16 +156,16 @@ void Extrema_ExtCC::SetTolerance (const Standard_Integer theRank, const Standard
//purpose :
//=======================================================================
void Extrema_ExtCC::Perform()
void Extrema_GExtCC::Perform()
{
Standard_NullObject_Raise_if (!myC[0] || !myC[1], "Extrema_ExtCC::Perform()")
Standard_NullObject_Raise_if (!myC[0] || !myC[1], "Extrema_GExtCC::Perform()")
myDone = Standard_False;
mypoints.Clear();
mySqDist.Clear();
myIsPar = Standard_False;
GeomAbs_CurveType type1 = (*((Adaptor3d_Curve*)myC[0])).GetType();
GeomAbs_CurveType type2 = (*((Adaptor3d_Curve*)myC[1])).GetType();
GeomAbs_CurveType type1 = (*((Curve1*)myC[0])).GetType();
GeomAbs_CurveType type2 = (*((Curve2*)myC[1])).GetType();
Standard_Real U11, U12, U21, U22, Tol = Min(myTol[0], myTol[1]);
mynbext = 0;
inverse = Standard_False;
@@ -179,10 +175,10 @@ void Extrema_ExtCC::Perform()
U21 = myInf[1];
U22 = mySup[1];
if (!Precision::IsInfinite(U11)) P1f = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), U11);
if (!Precision::IsInfinite(U12)) P1l = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), U12);
if (!Precision::IsInfinite(U21)) P2f = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), U21);
if (!Precision::IsInfinite(U22)) P2l = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), U22);
if (!Precision::IsInfinite(U11)) P1f = Tool1::Value(*((Curve1*)myC[0]), U11);
if (!Precision::IsInfinite(U12)) P1l = Tool1::Value(*((Curve1*)myC[0]), U12);
if (!Precision::IsInfinite(U21)) P2f = Tool2::Value(*((Curve2*)myC[1]), U21);
if (!Precision::IsInfinite(U22)) P2l = Tool2::Value(*((Curve2*)myC[1]), U22);
if (Precision::IsInfinite(U11) || Precision::IsInfinite(U21)) mydist11 = RealLast();
@@ -214,27 +210,27 @@ void Extrema_ExtCC::Perform()
}
switch (aType2) {
case GeomAbs_Line: {
Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Line(), Tol);
Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Line(), Tol);
Results(Xtrem, U11, U12, U21, U22);
break;
}
case GeomAbs_Circle: {
Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Circle(), Tol);
Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Circle(), Tol);
Results(Xtrem, U11, U12, U21, U22);
break;
}
case GeomAbs_Ellipse: {
Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Ellipse());
Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Ellipse());
Results(Xtrem, U11, U12, U21, U22);
break;
}
case GeomAbs_Hyperbola: {
Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Hyperbola());
Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Hyperbola());
Results(Xtrem, U11, U12, U21, U22);
break;
}
case GeomAbs_Parabola: {
Extrema_ExtElC Xtrem((*((Adaptor3d_Curve*)myC[anInd1])).Line(), (*((Adaptor3d_Curve*)myC[anInd2])).Parabola());
Extrema_ExtElC Xtrem((*((Curve1*)myC[anInd1])).Line(), (*((Curve1*)myC[anInd2])).Parabola());
Results(Xtrem, U11, U12, U21, U22);
break;
}
@@ -243,7 +239,7 @@ void Extrema_ExtCC::Perform()
} else if (type1 == GeomAbs_Circle && type2 == GeomAbs_Circle) {
//analytical case - two circles
Standard_Boolean bIsDone;
Extrema_ExtElC CCXtrem ((*((Adaptor3d_Curve*)myC[0])).Circle(), (*((Adaptor3d_Curve*)myC[1])).Circle());
Extrema_ExtElC CCXtrem ((*((Curve1*)myC[0])).Circle(), (*((Curve2*)myC[1])).Circle());
bIsDone = CCXtrem.IsDone();
if(bIsDone) {
Results(CCXtrem, U11, U12, U21, U22);
@@ -255,9 +251,9 @@ void Extrema_ExtCC::Perform()
TColStd_ListOfTransient& aCacheList = myCacheLists[i];
if (aCacheList.IsEmpty()) {
//no caches, build them
Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)myC[i];
Curve1& aC = *(Curve1*)myC[i];
//single interval from myInf[i] to mySup[i]
Handle(Extrema_CCache) aCache = new Extrema_CCache(aC, myInf[i], mySup[i], aNbS, Standard_True);
Handle(Extrema_CCache) aCache = new Extrema_CCache (aC, myInf[i], mySup[i], aNbS, Standard_True);
aCacheList.Append (aCache);
}
}
@@ -281,7 +277,7 @@ void Extrema_ExtCC::Perform()
TColStd_ListOfTransient& aCacheList = myCacheLists[i];
if (aCacheList.IsEmpty()) {
//no caches, build them
Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)myC[i];
Curve1& aC = *(Curve1*)myC[i];
Standard_Real du1 = 0., t = 0.;
gp_Pnt P1, P2;
@@ -296,8 +292,8 @@ void Extrema_ExtCC::Perform()
KnotSampling[i] = Standard_True;
aNbS[i] = aC.NbPoles() * 2;
rf = (Extrema_CurveTool::BSpline(*((Adaptor3d_Curve*)myC[i])))->FirstParameter();
rl = (Extrema_CurveTool::BSpline(*((Adaptor3d_Curve*)myC[i])))->LastParameter();
rf = (Tool1::BSpline(*((Curve1*)myC[i])))->FirstParameter();
rl = (Tool1::BSpline(*((Curve1*)myC[i])))->LastParameter();
aNbS[i] = (Standard_Integer) ( aNbS[i] * ((mySup[i] - myInf[i]) / (rl - rf)) + 1 );
case GeomAbs_OtherCurve:
case GeomAbs_Line:
@@ -306,9 +302,9 @@ void Extrema_ExtCC::Perform()
aNbS[i] = Max(aNbS[i] / aNbInter[i], 3);
LL[i] = 0.;
du1 = (mySup[i] - myInf[i]) / ((aNbS[i]-1)*aNbInter[i]);
P1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[i]), myInf[i]);
P1 = Tool1::Value(*((Curve1*)myC[i]), myInf[i]);
for(t = myInf[i] + du1; t <= mySup[i]; t += du1) {
P2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[i]), t);
P2 = Tool1::Value(*((Curve1*)myC[i]), t);
LL[i] += P1.Distance(P2);
P1 = P2;
}
@@ -347,7 +343,7 @@ void Extrema_ExtCC::Perform()
TColStd_ListOfTransient& aCacheList = myCacheLists[i];
if (aCacheList.IsEmpty()) {
//no caches, build them
Adaptor3d_Curve& aC = *(Adaptor3d_Curve*)myC[i];
Curve1& aC = *(Curve1*)myC[i];
if (aC.GetType() >= GeomAbs_BSplineCurve)
{
@@ -373,7 +369,7 @@ void Extrema_ExtCC::Perform()
while (NextKnot != anArr(k+1));
Handle(Extrema_CCache) aCache =
new Extrema_CCache(aC, anArr(k), anArr(k+1),
new Extrema_CCache (aC, anArr(k), anArr(k+1),
IntervalsCN, start_j, j, Coeff[i]);
aCacheList.Append (aCache);
@@ -384,7 +380,7 @@ void Extrema_ExtCC::Perform()
{
for (Standard_Integer k = 1; k <= aNbInter[i]; k++) {
Handle(Extrema_CCache) aCache =
new Extrema_CCache(aC, anArr(k), anArr(k+1), aNbS[i], Standard_True);
new Extrema_CCache (aC, anArr(k), anArr(k+1), aNbS[i], Standard_True);
aCacheList.Append (aCache);
}
}
@@ -421,7 +417,7 @@ void Extrema_ExtCC::Perform()
//purpose :
//=======================================================================
Standard_Boolean Extrema_ExtCC::IsDone() const
Standard_Boolean Extrema_GExtCC::IsDone() const
{
return myDone;
}
@@ -431,7 +427,7 @@ Standard_Boolean Extrema_ExtCC::IsDone() const
//purpose :
//=======================================================================
Standard_Boolean Extrema_ExtCC::IsParallel() const
Standard_Boolean Extrema_GExtCC::IsParallel() const
{
return myIsPar;
}
@@ -442,7 +438,7 @@ Standard_Boolean Extrema_ExtCC::IsParallel() const
//purpose :
//=======================================================================
Standard_Real Extrema_ExtCC::SquareDistance(const Standard_Integer N) const
Standard_Real Extrema_GExtCC::SquareDistance(const Standard_Integer N) const
{
if(!myDone) StdFail_NotDone::Raise();
if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
@@ -455,7 +451,7 @@ Standard_Real Extrema_ExtCC::SquareDistance(const Standard_Integer N) const
//purpose :
//=======================================================================
Standard_Integer Extrema_ExtCC::NbExt() const
Standard_Integer Extrema_GExtCC::NbExt() const
{
if(!myDone) StdFail_NotDone::Raise();
return mynbext;
@@ -467,7 +463,7 @@ Standard_Integer Extrema_ExtCC::NbExt() const
//purpose :
//=======================================================================
void Extrema_ExtCC::Points(const Standard_Integer N,
void Extrema_GExtCC::Points(const Standard_Integer N,
Extrema_POnCurv& P1,
Extrema_POnCurv& P2) const
{
@@ -484,7 +480,7 @@ void Extrema_ExtCC::Points(const Standard_Integer N,
//purpose :
//=======================================================================
void Extrema_ExtCC::TrimmedSquareDistances(Standard_Real& dist11,
void Extrema_GExtCC::TrimmedSquareDistances(Standard_Real& dist11,
Standard_Real& dist12,
Standard_Real& dist21,
Standard_Real& dist22,
@@ -510,7 +506,7 @@ void Extrema_ExtCC::TrimmedSquareDistances(Standard_Real& dist11,
//purpose :
//=======================================================================
void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
void Extrema_GExtCC::Results(const Extrema_ExtElC& AlgExt,
const Standard_Real Ut11,
const Standard_Real Ut12,
const Standard_Real Ut21,
@@ -524,17 +520,17 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
if (myDone) {
myIsPar = AlgExt.IsParallel();
if (myIsPar) {
GeomAbs_CurveType type = Extrema_CurveTool::GetType(*((Adaptor3d_Curve*)myC[0]));
GeomAbs_CurveType type2 = Extrema_CurveTool::GetType(*((Adaptor3d_Curve*)myC[1]));
GeomAbs_CurveType type = Tool1::GetType(*((Curve1*)myC[0]));
GeomAbs_CurveType type2 = Tool2::GetType(*((Curve2*)myC[1]));
// Parallel case is only for line-line, circle-circle and circle-line!!!
// But really for trimmed curves extremas can not exist!
Extrema_POnCurv dummypoint(0., gp_Pnt(0.,0.,0.));
if(type != type2) {
mySqDist.Append(AlgExt.SquareDistance(1));
if(type == GeomAbs_Circle) {
gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut11);
gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut11);
P1.SetValues(Ut11, PonC1);
Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
if(ExtPLin.IsDone()) {
mynbext = 1;
P2 = ExtPLin.Point(1);
@@ -549,9 +545,9 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
}
else {
gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut21);
gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut21);
P2.SetValues(Ut21, PonC2);
Extrema_ExtPElC ExtPLin(PonC2, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
Extrema_ExtPElC ExtPLin(PonC2, Tool1::Line(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
if(ExtPLin.IsDone()) {
mynbext = 1;
P1 = ExtPLin.Point(1);
@@ -577,9 +573,9 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
if(infinite) {
mynbext = 1;
mySqDist.Append(AlgExt.SquareDistance(1));
gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), 0.);
gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), 0.);
P1.SetValues(0., PonC1);
Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
if(ExtPLin.IsDone()) {
P2 = ExtPLin.Point(1);
mypoints.Append(P1);
@@ -594,8 +590,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
else {
Standard_Boolean finish = Standard_False;
if(!Precision::IsInfinite(Ut11)) {
gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut11);
Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut11);
Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
mynbext = 1;
mySqDist.Append(AlgExt.SquareDistance(1));
@@ -608,8 +604,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
if(!finish) {
if(!Precision::IsInfinite(Ut12)) {
gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut12);
Extrema_ExtPElC ExtPLin(PonC1, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut12);
Extrema_ExtPElC ExtPLin(PonC1, Tool2::Line(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
mynbext = 1;
mySqDist.Append(AlgExt.SquareDistance(1));
@@ -623,8 +619,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
if(!finish) {
if(!Precision::IsInfinite(Ut21)) {
gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut21);
Extrema_ExtPElC ExtPLin(PonC2, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut21);
Extrema_ExtPElC ExtPLin(PonC2, Tool1::Line(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
mynbext = 1;
mySqDist.Append(AlgExt.SquareDistance(1));
@@ -638,8 +634,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
if(!finish) {
if(!Precision::IsInfinite(Ut22)) {
gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut22);
Extrema_ExtPElC ExtPLin(PonC2, Extrema_CurveTool::Line(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut22);
Extrema_ExtPElC ExtPLin(PonC2, Tool1::Line(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
if(ExtPLin.IsDone() && ExtPLin.NbExt() > 0) {
mynbext = 1;
mySqDist.Append(AlgExt.SquareDistance(1));
@@ -663,9 +659,9 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
else {
Standard_Boolean finish = Standard_False;
gp_Pnt PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut11);
gp_Pnt PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut11);
P1.SetValues(Ut11, PonC1);
Extrema_ExtPElC ExtPCir(PonC1, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
Extrema_ExtPElC ExtPCir(PonC1, Tool2::Circle(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
for(i = 1; i <= ExtPCir.NbExt(); i++) {
mynbext++;
@@ -677,8 +673,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
if(mynbext == 2) finish = Standard_True;
}
if(!finish) {
PonC1 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[0]), Ut12);
ExtPCir.Perform(PonC1, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[1])), Precision::Confusion(), Ut21, Ut22);
PonC1 = Tool1::Value(*((Curve1*)myC[0]), Ut12);
ExtPCir.Perform(PonC1, Tool2::Circle(*((Curve2*)myC[1])), Precision::Confusion(), Ut21, Ut22);
P1.SetValues(Ut12, PonC1);
if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
if(mynbext == 0) {
@@ -707,8 +703,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
}
if(!finish) {
gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut21);
ExtPCir.Perform(PonC2, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut21);
ExtPCir.Perform(PonC2, Tool1::Circle(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
P2.SetValues(Ut21, PonC2);
if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
if(mynbext == 0) {
@@ -737,8 +733,8 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
}
}
if(!finish) {
gp_Pnt PonC2 = Extrema_CurveTool::Value(*((Adaptor3d_Curve*)myC[1]), Ut22);
ExtPCir.Perform(PonC2, Extrema_CurveTool::Circle(*((Adaptor3d_Curve*)myC[0])), Precision::Confusion(), Ut11, Ut12);
gp_Pnt PonC2 = Tool2::Value(*((Curve2*)myC[1]), Ut22);
ExtPCir.Perform(PonC2, Tool1::Circle(*((Curve1*)myC[0])), Precision::Confusion(), Ut11, Ut12);
P2.SetValues(Ut22, PonC2);
if(ExtPCir.IsDone() && ExtPCir.NbExt() > 0) {
if(mynbext == 0) {
@@ -791,11 +787,11 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
U = P2.Parameter();
}
if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[0]))) {
U = ElCLib::InPeriod(U, Ut11, Ut11+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[0])));
if (Tool1::IsPeriodic(*((Curve1*)myC[0]))) {
U = ElCLib::InPeriod(U, Ut11, Ut11+Tool1::Period(*((Curve1*)myC[0])));
}
if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[1]))) {
U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[1])));
if (Tool2::IsPeriodic(*((Curve2*)myC[1]))) {
U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Tool2::Period(*((Curve2*)myC[1])));
}
if ((U >= Ut11 - RealEpsilon()) &&
@@ -830,7 +826,7 @@ void Extrema_ExtCC::Results(const Extrema_ExtElC& AlgExt,
//purpose :
//=======================================================================
void Extrema_ExtCC::Results(const Extrema_ECC& AlgExt,
void Extrema_GExtCC::Results(const Extrema_ECC& AlgExt,
const Standard_Real Ut11,
const Standard_Real Ut12,
const Standard_Real Ut21,
@@ -860,11 +856,11 @@ void Extrema_ExtCC::Results(const Extrema_ECC& AlgExt,
if (IsExtrema)
{
// Verification de la validite des parametres
if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[0]))) {
U = ElCLib::InPeriod(U, Ut11, Ut11+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[0])));
if (Tool1::IsPeriodic(*((Curve1*)myC[0]))) {
U = ElCLib::InPeriod(U, Ut11, Ut11+Tool1::Period(*((Curve1*)myC[0])));
}
if (Extrema_CurveTool::IsPeriodic(*((Adaptor3d_Curve*)myC[1]))) {
U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Extrema_CurveTool::Period(*((Adaptor3d_Curve*)myC[1])));
if (Tool2::IsPeriodic(*((Curve2*)myC[1]))) {
U2 = ElCLib::InPeriod(U2, Ut21, Ut21+Tool2::Period(*((Curve2*)myC[1])));
}
if ((U >= Ut11 - RealEpsilon()) &&

View File

@@ -14,49 +14,61 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ExtCC2d from Extrema
generic class GExtCC2d from Extrema (Curve1 as any;
Tool1 as any;
Curve2 as any;
Tool2 as any)
---Purpose: It calculates all the distance between two curves.
-- These distances can be maximum or minimum.
---Purpose: It calculates all the distance between two curves.
-- These distances can be maximum or minimum.
uses POnCurv2d from Extrema,
SequenceOfPOnCurv2d from Extrema,
ExtElC2d from Extrema,
Pnt2d from gp,
HArray1OfPnt2d from TColgp,
SequenceOfReal from TColStd,
Curve2d from Adaptor2d,
Curve2dTool from Extrema,
CCache2d from Extrema,
ECC2d from Extrema
SequenceOfReal from TColStd
raises InfiniteSolutions from StdFail,
NotDone from StdFail,
OutOfRange from Standard
NotDone from StdFail,
OutOfRange from Standard
class CCache2d instantiates CurveCache from Extrema (Curve1, Pnt2d from gp, HArray1OfPnt2d from TColgp);
class ECC2d instantiates GenExtCC from Extrema
(Curve1,
Tool1,
Curve2,
Tool2,
CCache2d,
HArray1OfPnt2d from TColgp,
POnCurv2d,
Pnt2d,
Vec2d);
is
Create returns ExtCC2d;
Create returns GExtCC2d;
Create (C1: Curve2d from Adaptor2d; C2: Curve2d from Adaptor2d;
TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns ExtCC2d;
Create (C1: Curve1; C2: Curve2;
TolC1: Real = 1.0e-10; TolC2: Real = 1.0e-10) returns GExtCC2d;
---Purpose: It calculates all the distances.
Create (C1: Curve2d from Adaptor2d;
C2: Curve2d from Adaptor2d;
Create (C1: Curve1;
C2: Curve2;
U1: Real from Standard;
U2: Real from Standard;
V1: Real from Standard;
V2: Real from Standard;
TolC1: Real = 1.0e-10;
TolC2: Real = 1.0e-10) returns ExtCC2d;
TolC2: Real = 1.0e-10) returns GExtCC2d;
---Purpose: It calculates all the distances.
Initialize(me: in out; C2: Curve2d from Adaptor2d;
Initialize(me: in out; C2: Curve2;
V1, V2: Real from Standard;
TolC1: Real = 1.0e-10;
TolC2: Real = 1.0e-10)
@@ -64,7 +76,7 @@ is
is static;
Perform(me: in out; C1: Curve2d from Adaptor2d;
Perform(me: in out; C1: Curve1;
U1, U2: Real from Standard)
is static;
@@ -127,7 +139,7 @@ is
is static protected;
-- modified by NIZHNY-EAP Thu Jan 27 16:53:25 2000 ___BEGIN___
Results(me: in out;AlgExt: ECC2d from Extrema; C : Curve2d from Adaptor2d;
Results(me: in out;AlgExt: ECC2d; C : Curve1;
-- modified by NIZHNY-EAP Thu Jan 27 16:53:26 2000 ___END___
Ut11, Ut12, Ut21, Ut22: Real;
Period1 : Real from Standard = 0.0;
@@ -159,4 +171,4 @@ fields
end ExtCC2d;
end GExtCC2d;

View File

@@ -14,8 +14,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Extrema_ExtCC2d.ixx>
#include Extrema_ECC2d_hxx
#include <Extrema_ExtElC2d.hxx>
#include <StdFail_NotDone.hxx>
#include <Extrema_ExtElC.hxx>
@@ -34,9 +33,6 @@
#include <Standard_NotImplemented.hxx>
#include <Precision.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <Extrema_Curve2dTool.hxx>
//=======================================================================
//function : IsParallelDot
@@ -52,20 +48,20 @@ static Standard_Boolean IsParallelDot( gp_Vec2d theV1,
theV1.Magnitude()*theV2.Magnitude()*cos(AngTol);
}
Extrema_ExtCC2d::Extrema_ExtCC2d() {}
Extrema_GExtCC2d::Extrema_GExtCC2d() {}
Extrema_ExtCC2d::Extrema_ExtCC2d(const Adaptor2d_Curve2d& C1,
const Adaptor2d_Curve2d& C2,
Extrema_GExtCC2d::Extrema_GExtCC2d(const Curve1& C1,
const Curve2& C2,
const Standard_Real TolC1,
const Standard_Real TolC2)
{
Initialize(C2, Extrema_Curve2dTool::FirstParameter(C2), Extrema_Curve2dTool::LastParameter(C2), TolC1, TolC2);
Perform(C1, Extrema_Curve2dTool::FirstParameter(C1), Extrema_Curve2dTool::LastParameter(C1));
Initialize(C2, Tool2::FirstParameter(C2), Tool2::LastParameter(C2), TolC1, TolC2);
Perform(C1, Tool1::FirstParameter(C1), Tool1::LastParameter(C1));
}
Extrema_ExtCC2d::Extrema_ExtCC2d(const Adaptor2d_Curve2d& C1,
const Adaptor2d_Curve2d& C2,
Extrema_GExtCC2d::Extrema_GExtCC2d(const Curve1& C1,
const Curve2& C2,
const Standard_Real U1,
const Standard_Real U2,
const Standard_Real V1,
@@ -79,7 +75,7 @@ Extrema_ExtCC2d::Extrema_ExtCC2d(const Adaptor2d_Curve2d& C1,
void Extrema_ExtCC2d::Initialize(const Adaptor2d_Curve2d& C2,
void Extrema_GExtCC2d::Initialize(const Curve2& C2,
const Standard_Real V1,
const Standard_Real V2,
const Standard_Real TolC1,
@@ -94,14 +90,14 @@ void Extrema_ExtCC2d::Initialize(const Adaptor2d_Curve2d& C2,
void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
void Extrema_GExtCC2d::Perform (const Curve1& C1,
const Standard_Real U1,
const Standard_Real U2)
{
mypoints.Clear();
mySqDist.Clear();
Standard_Integer NbU = 32, NbV = 32;
GeomAbs_CurveType type1 = Extrema_Curve2dTool::GetType(C1), type2 = Extrema_Curve2dTool::GetType(*((Adaptor2d_Curve2d*)myC));
GeomAbs_CurveType type1 = Tool1::GetType(C1), type2 = Tool2::GetType(*((Curve2*)myC));
Standard_Real U11, U12, U21, U22, Tol = Min(mytolc1, mytolc2);
// Extrema_POnCurv2d P1, P2;
mynbext = 0;
@@ -112,10 +108,10 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
U12 = U2;
U21 = myv1;
U22 = myv2;
P1f = Extrema_Curve2dTool::Value(C1, U11);
P1l = Extrema_Curve2dTool::Value(C1, U12);
P2f = Extrema_Curve2dTool::Value(*((Adaptor2d_Curve2d*)myC), U21);
P2l = Extrema_Curve2dTool::Value(*((Adaptor2d_Curve2d*)myC), U22);
P1f = Tool1::Value(C1, U11);
P1l = Tool1::Value(C1, U12);
P2f = Tool2::Value(*((Curve2*)myC), U21);
P2l = Tool2::Value(*((Curve2*)myC), U22);
switch(type1) {
@@ -126,38 +122,38 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
switch(type2) {
case GeomAbs_Circle: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Circle(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
}
break;
case GeomAbs_Ellipse: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Ellipse(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI );
}
break;
case GeomAbs_Parabola: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Parabola(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
}
break;
case GeomAbs_Hyperbola: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Circle(C1), Tool2::Hyperbola(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0. );
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_OtherCurve:
case GeomAbs_BSplineCurve: {
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Standard_Real Period2 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI,Period2);
}
break;
case GeomAbs_Line: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Circle(C1), Tol);
Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Circle(C1), Tol);
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
}
break;
@@ -173,27 +169,27 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
switch(type2) {
case GeomAbs_Circle: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Ellipse(C1));
Extrema_ExtElC2d Xtrem(Tool2::Circle(*((Curve2*)myC)), Tool1::Ellipse(C1));
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 2*M_PI);
}
break;
case GeomAbs_Ellipse: {
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool1::Ellipse(C1), Tool2::Ellipse(*((Curve2*)myC)));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22,2*M_PI, 2*M_PI);
}
break;
case GeomAbs_Parabola: {
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool1::Ellipse(C1), Tool2::Parabola(*((Curve2*)myC)));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI, 0.);
}
break;
case GeomAbs_Hyperbola: {
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool1::Ellipse(C1), Tool2::Hyperbola(*((Curve2*)myC)));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI, 0.);
}
@@ -201,16 +197,16 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
case GeomAbs_BezierCurve:
case GeomAbs_OtherCurve:
case GeomAbs_BSplineCurve: {
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Standard_Real Period2 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
Results(Xtrem, C1, U11, U12, U21, U22, 2*M_PI,Period2);
}
break;
case GeomAbs_Line: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Ellipse(C1));
Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Ellipse(C1));
Results(Xtrem, U11, U12, U21, U22, 2*M_PI, 0.);
}
break;
@@ -226,29 +222,29 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
switch(type2) {
case GeomAbs_Circle: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
Extrema_ExtElC2d Xtrem(Tool2::Circle(*((Curve2*)myC)), Tool1::Parabola(C1));
Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
}
break;
case GeomAbs_Ellipse: {
//inverse = Standard_True;
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool2::Ellipse(*((Curve2*)myC)), Tool1::Parabola(C1));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 0., 2*M_PI);
}
break;
case GeomAbs_Parabola: {
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Parabola(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool1::Parabola(C1), Tool2::Parabola(*((Curve2*)myC)));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
}
break;
case GeomAbs_Hyperbola: {
//inverse = Standard_True;
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool2::Hyperbola(*((Curve2*)myC)), Tool1::Parabola(C1));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
}
@@ -256,16 +252,16 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
case GeomAbs_BezierCurve:
case GeomAbs_OtherCurve:
case GeomAbs_BSplineCurve: {
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Standard_Real Period2 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
}
break;
case GeomAbs_Line: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Parabola(C1));
Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Parabola(C1));
Results(Xtrem, U11, U12, U21, U22, 0., 0.);
}
break;
@@ -281,28 +277,28 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
switch(type2) {
case GeomAbs_Circle: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
Extrema_ExtElC2d Xtrem(Tool2::Circle(*((Curve2*)myC)), Tool1::Hyperbola(C1));
Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
}
break;
case GeomAbs_Ellipse: {
//inverse = Standard_True;
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool2::Ellipse(*((Curve2*)myC)), Tool1::Hyperbola(C1));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 0., 2*M_PI );
}
break;
case GeomAbs_Parabola: {
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool1::Hyperbola(C1), Tool2::Parabola(*((Curve2*)myC)));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
}
break;
case GeomAbs_Hyperbola: {
//Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Hyperbola(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
//Extrema_ExtElC2d Xtrem(Tool1::Hyperbola(C1), Tool2::Hyperbola(*((Curve2*)myC)));
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Results(Xtrem, C1, U11, U12, U21, U22, 0., 0.);
}
@@ -310,16 +306,16 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
case GeomAbs_OtherCurve:
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve: {
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC)
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC)
, NbU, NbV, mytolc1, mytolc2);
Standard_Real Period2 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
}
break;
case GeomAbs_Line: {
inverse = Standard_True;
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Extrema_Curve2dTool::Hyperbola(C1));
Extrema_ExtElC2d Xtrem(Tool2::Line(*((Curve2*)myC)), Tool1::Hyperbola(C1));
Results(Xtrem, U11, U12, U21, U22, 0., 0.);
}
break;
@@ -333,12 +329,12 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
case GeomAbs_BezierCurve:
case GeomAbs_OtherCurve:
case GeomAbs_BSplineCurve: {
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Standard_Real Period1 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(C1)) Period1 = Extrema_Curve2dTool::Period(C1);
if (Tool1::IsPeriodic(C1)) Period1 = Tool1::Period(C1);
Standard_Real Period2 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
Results(Xtrem, C1, U11, U12, U21, U22, Period1, Period2);
}
break;
@@ -350,37 +346,37 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
switch(type2) {
case GeomAbs_Circle: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Circle(*((Adaptor2d_Curve2d*)myC)), Tol);
Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Circle(*((Curve2*)myC)), Tol);
Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
}
break;
case GeomAbs_Ellipse: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Ellipse(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Ellipse(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 0., 2*M_PI);
}
break;
case GeomAbs_Parabola: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Parabola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Parabola(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 0., 0.);
}
break;
case GeomAbs_Hyperbola: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Hyperbola(*((Adaptor2d_Curve2d*)myC)));
Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Hyperbola(*((Curve2*)myC)));
Results(Xtrem, U11, U12, U21, U22, 0., 0.);
}
break;
case GeomAbs_BezierCurve:
case GeomAbs_OtherCurve:
case GeomAbs_BSplineCurve: {
Extrema_ECC2d Xtrem(C1, *((Adaptor2d_Curve2d*)myC),
Extrema_ECC2d Xtrem(C1, *((Curve2*)myC),
NbU, NbV, mytolc1, mytolc2);
Standard_Real Period2 = 0.;
if (Extrema_Curve2dTool::IsPeriodic(*((Adaptor2d_Curve2d*)myC))) Period2 = Extrema_Curve2dTool::Period(*((Adaptor2d_Curve2d*)myC));
if (Tool2::IsPeriodic(*((Curve2*)myC))) Period2 = Tool2::Period(*((Curve2*)myC));
Results(Xtrem, C1, U11, U12, U21, U22, 0., Period2);
}
break;
case GeomAbs_Line: {
Extrema_ExtElC2d Xtrem(Extrema_Curve2dTool::Line(C1), Extrema_Curve2dTool::Line(*((Adaptor2d_Curve2d*)myC)), Tol);
Extrema_ExtElC2d Xtrem(Tool1::Line(C1), Tool2::Line(*((Curve2*)myC)), Tol);
Results(Xtrem, U11, U12, U21, U22, 0., 0.);
}
break;
@@ -393,13 +389,13 @@ void Extrema_ExtCC2d::Perform (const Adaptor2d_Curve2d& C1,
}
Standard_Boolean Extrema_ExtCC2d::IsDone() const
Standard_Boolean Extrema_GExtCC2d::IsDone() const
{
return myDone;
}
Standard_Real Extrema_ExtCC2d::SquareDistance(const Standard_Integer N) const
Standard_Real Extrema_GExtCC2d::SquareDistance(const Standard_Integer N) const
{
if(!myDone) StdFail_NotDone::Raise();
if ((N <= 0) || (N > mynbext)) Standard_OutOfRange::Raise();
@@ -407,14 +403,14 @@ Standard_Real Extrema_ExtCC2d::SquareDistance(const Standard_Integer N) const
}
Standard_Integer Extrema_ExtCC2d::NbExt() const
Standard_Integer Extrema_GExtCC2d::NbExt() const
{
if(!myDone) StdFail_NotDone::Raise();
return mynbext;
}
void Extrema_ExtCC2d::Points(const Standard_Integer N,
void Extrema_GExtCC2d::Points(const Standard_Integer N,
Extrema_POnCurv2d& P1,
Extrema_POnCurv2d& P2) const
{
@@ -426,7 +422,7 @@ void Extrema_ExtCC2d::Points(const Standard_Integer N,
void Extrema_ExtCC2d::TrimmedSquareDistances(Standard_Real& dist11,
void Extrema_GExtCC2d::TrimmedSquareDistances(Standard_Real& dist11,
Standard_Real& dist12,
Standard_Real& dist21,
Standard_Real& dist22,
@@ -447,7 +443,7 @@ void Extrema_ExtCC2d::TrimmedSquareDistances(Standard_Real& dist11,
void Extrema_ExtCC2d::Results(const Extrema_ExtElC2d& AlgExt,
void Extrema_GExtCC2d::Results(const Extrema_ExtElC2d& AlgExt,
const Standard_Real Ut11,
const Standard_Real Ut12,
const Standard_Real Ut21,
@@ -510,9 +506,9 @@ void Extrema_ExtCC2d::Results(const Extrema_ExtElC2d& AlgExt,
}
void Extrema_ExtCC2d::Results(const Extrema_ECC2d& AlgExt,
void Extrema_GExtCC2d::Results(const Extrema_ECC2d& AlgExt,
// modified by NIZHNY-EAP Wed Feb 23 14:51:24 2000 ___BEGIN___
const Adaptor2d_Curve2d& C1,
const Curve1& C1,
// modified by NIZHNY-EAP Wed Feb 23 14:51:26 2000 ___END___
const Standard_Real Ut11,
const Standard_Real Ut12,
@@ -545,8 +541,8 @@ void Extrema_ExtCC2d::Results(const Extrema_ECC2d& AlgExt,
// to be sure that it's a real extrema
gp_Pnt2d p;
gp_Vec2d v1, v2;
Extrema_Curve2dTool::D1(C1,U,p, v1);
Extrema_Curve2dTool::D1(*((Adaptor2d_Curve2d*)myC),U2,p, v2);
Tool1::D1(C1,U,p, v1);
Tool2::D1(*((Curve2*)myC),U2,p, v2);
if (IsParallelDot(v1, v2, Precision::Angular()))
{
mynbext++;
@@ -570,7 +566,7 @@ void Extrema_ExtCC2d::Results(const Extrema_ECC2d& AlgExt,
}
Standard_Boolean Extrema_ExtCC2d::IsParallel() const
Standard_Boolean Extrema_GExtCC2d::IsParallel() const
{
if (!myDone) StdFail_NotDone::Raise();
return myIsPar;

View File

@@ -14,24 +14,50 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class LocateExtCC from Extrema
generic class GLocateExtCC from Extrema (Curve1 as any;
Tool1 as any;
Curve2 as any;
Tool2 as any)
---Purpose: It calculates the distance between two curves with
-- a close point; these distances can be maximum or
-- minimum.
---Purpose: It calculates the distance between two curves with
-- a close point; these distances can be maximum or
-- minimum.
uses POnCurv from Extrema,
Pnt from gp,
HArray1OfPnt from TColgp,
Curve from Adaptor3d,
CurveTool from Extrema
uses POnCurv from Extrema,
Pnt from gp,
HArray1OfPnt from TColgp
raises DomainError from Standard,
NotDone from StdFail
NotDone from StdFail
class LCCache instantiates CurveCache from Extrema (Curve1, Pnt from gp, HArray1OfPnt from TColgp);
class ELCC instantiates GenExtCC from Extrema
(Curve1,
Tool1,
Curve2,
Tool2,
LCCache,
HArray1OfPnt from TColgp,
POnCurv,
Pnt,
Vec);
class LocECC instantiates GenLocateExtCC from Extrema
(Curve1,
Tool1,
Curve2,
Tool2,
POnCurv,
Pnt,
Vec);
is
Create (C1: Curve from Adaptor3d; C2: Curve from Adaptor3d; U0,V0: Real)
returns LocateExtCC
Create (C1: Curve1; C2: Curve2; U0,V0: Real)
returns GLocateExtCC
---Purpose: Calculates the distance with a close point. The
-- close point is defined by a parameter value on each
-- curve.
@@ -65,4 +91,4 @@ fields
myPoint1: POnCurv;
myPoint2: POnCurv;
end LocateExtCC;
end GLocateExtCC;

View File

@@ -14,19 +14,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Extrema_LocateExtCC.ixx>
#include Extrema_ELCC_hxx
#include Extrema_LocECC_hxx
#include <StdFail_NotDone.hxx>
#include <Extrema_POnCurv.hxx>
#include <Precision.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Extrema_LocECC.hxx>
Extrema_LocateExtCC::Extrema_LocateExtCC (const Adaptor3d_Curve& C1,
const Adaptor3d_Curve& C2,
const Standard_Real U0,
const Standard_Real V0)
Extrema_GLocateExtCC::Extrema_GLocateExtCC (const Curve1& C1,
const Curve2& C2,
const Standard_Real U0,
const Standard_Real V0)
{
Standard_Real TolU = C1.Resolution(Precision::Confusion());
Standard_Real TolV = C2.Resolution(Precision::Confusion());
@@ -34,8 +31,9 @@ Extrema_LocateExtCC::Extrema_LocateExtCC (const Adaptor3d_Curve& C1,
// Non implemente pour l instant: l appel a Extrema_ELCC.
Extrema_LocECC Xtrem(C1, C2,
U0, V0, TolU, TolV);
U0, V0, TolU, TolV);
// Exploitation
myDone = Xtrem.IsDone();
@@ -45,20 +43,27 @@ Extrema_LocateExtCC::Extrema_LocateExtCC (const Adaptor3d_Curve& C1,
myPoint1 = P1;
myPoint2 = P2;
}
}
Standard_Boolean Extrema_LocateExtCC::IsDone () const {
Standard_Boolean Extrema_GLocateExtCC::IsDone () const {
return myDone;
}
Standard_Real Extrema_LocateExtCC::SquareDistance() const {
Standard_Real Extrema_GLocateExtCC::SquareDistance() const {
if (!myDone) { StdFail_NotDone::Raise(); }
return mySqDist;
}
void Extrema_LocateExtCC::Point (Extrema_POnCurv& P1, Extrema_POnCurv& P2) const {
void Extrema_GLocateExtCC::Point (Extrema_POnCurv& P1, Extrema_POnCurv& P2) const {
if (!myDone) { StdFail_NotDone::Raise(); }
P1 = myPoint1;

View File

@@ -14,26 +14,51 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class LocateExtCC2d from Extrema
generic class GLocateExtCC2d from Extrema (Curve1 as any;
Tool1 as any;
Curve2 as any;
Tool2 as any)
---Purpose: It calculates the distance between two curves with
-- a close point; these distances can be maximum or
-- minimum.
---Purpose: It calculates the distance between two curves with
-- a close point; these distances can be maximum or
-- minimum.
uses POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp,
HArray1OfPnt2d from TColgp,
Curve2d from Adaptor2d,
Curve2dTool from Extrema,
LCCache2d from Extrema
uses POnCurv2d from Extrema,
Pnt2d from gp,
Vec2d from gp,
HArray1OfPnt2d from TColgp
raises DomainError from Standard,
NotDone from StdFail
NotDone from StdFail
class LCCache2d instantiates CurveCache from Extrema (Curve1, Pnt2d from gp, HArray1OfPnt2d from TColgp);
class ELCC2d instantiates GenExtCC from Extrema
(Curve1,
Tool1,
Curve2,
Tool2,
LCCache2d,
HArray1OfPnt2d from TColgp,
POnCurv2d,
Pnt2d,
Vec2d);
class LocECC2d instantiates GenLocateExtCC from Extrema
(Curve1,
Tool1,
Curve2,
Tool2,
POnCurv2d,
Pnt2d,
Vec2d);
is
Create (C1: Curve2d from Adaptor2d; C2: Curve2d from Adaptor2d; U0,V0: Real)
returns LocateExtCC2d
Create (C1: Curve1; C2: Curve2; U0,V0: Real)
returns GLocateExtCC2d
---Purpose: Calculates the distance with a close point. The
-- close point is defined by a parameter value on each
-- curve.
@@ -67,4 +92,4 @@ fields
myPoint1: POnCurv2d;
myPoint2: POnCurv2d;
end LocateExtCC2d;
end GLocateExtCC2d;

View File

@@ -14,30 +14,26 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Extrema_LocateExtCC2d.hxx>
#include Extrema_ELCC2d_hxx
#include Extrema_LocECC2d_hxx
#include <GeomAbs_CurveType.hxx>
#include <StdFail_NotDone.hxx>
#include <Extrema_POnCurv2d.hxx>
#include <Precision.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <Extrema_Curve2dTool.hxx>
#include <Extrema_LocECC2d.hxx>
//=======================================================================
//function : Extrema_LocateExtCC2d
//function : Extrema_GLocateExtCC2d
//purpose :
//=======================================================================
Extrema_LocateExtCC2d::Extrema_LocateExtCC2d (const Adaptor2d_Curve2d& C1,
const Adaptor2d_Curve2d& C2,
const Standard_Real U0,
const Standard_Real V0)
Extrema_GLocateExtCC2d::Extrema_GLocateExtCC2d (const Curve1& C1,
const Curve2& C2,
const Standard_Real U0,
const Standard_Real V0)
{
Standard_Real TolU = Extrema_Curve2dTool::Resolution(C1, Precision::Confusion());
Standard_Real TolV = Extrema_Curve2dTool::Resolution(C2, Precision::Confusion());
Standard_Real TolU = Tool1::Resolution(C1, Precision::Confusion());
Standard_Real TolV = Tool2::Resolution(C2, Precision::Confusion());
Extrema_POnCurv2d P1, P2;
// Non implemente pour l instant: l appel a Geom2dExtrema_ExtCC.
@@ -64,7 +60,7 @@ Extrema_LocateExtCC2d::Extrema_LocateExtCC2d (const Adaptor2d_Curve2d& C1,
//purpose :
//=======================================================================
Standard_Boolean Extrema_LocateExtCC2d::IsDone () const {
Standard_Boolean Extrema_GLocateExtCC2d::IsDone () const {
return myDone;
}
@@ -75,7 +71,7 @@ Standard_Boolean Extrema_LocateExtCC2d::IsDone () const {
//purpose :
//=======================================================================
Standard_Real Extrema_LocateExtCC2d::SquareDistance() const {
Standard_Real Extrema_GLocateExtCC2d::SquareDistance() const {
if (!myDone) { StdFail_NotDone::Raise(); }
return mySqDist;
@@ -88,8 +84,8 @@ Standard_Real Extrema_LocateExtCC2d::SquareDistance() const {
//purpose :
//=======================================================================
void Extrema_LocateExtCC2d::Point (Extrema_POnCurv2d& P1,
Extrema_POnCurv2d& P2) const
void Extrema_GLocateExtCC2d::Point (Extrema_POnCurv2d& P1,
Extrema_POnCurv2d& P2) const
{
if (!myDone) { StdFail_NotDone::Raise(); }
P1 = myPoint1;

View File

@@ -82,16 +82,40 @@ enumeration ValueType
--- Purpose :
-- Computes the global properties of a set of points in 3d.
-- This class inherits GProps.
generic class CGProps;
---Purpose :
-- Computes the global properties of a bounded
-- curve in 3d. This class inherits GProps.
class CelGProps;
---Purpose :
-- Computes the global properties of a gp curve in 3d
-- This class inherits GProps.
generic class SGProps;
---Purpose :
-- Computes the global properties and the area of a bounded
-- surface in 3d. This class inherits GProps.
class SelGProps;
---Purpose :
-- Computes the global properties and the area of a bounded
-- elementary surface in 3d. This class inherits GProps.
generic class VGProps;
---Purpose :
-- Computes the global properties and the volume of a region
-- of space. This class inherits GProps.
generic class VGPropsGK, UFunction, TFunction;
---Purpose :
-- Computes the global properties and the volume of a region
-- of space by adaptive Gauss-Kronrod integration.
-- This class inherits GProps.
class VelGProps;
---Purpose :

View File

@@ -17,30 +17,32 @@
-- Jean-Claude Vauthier January 1992, September 1992
class Cinert from BRepGProp inherits GProps from GProp
generic class CGProps from GProp (Curve as any;
Tool as any)
inherits GProps from GProp
--- Purpose :
-- Computes the global properties of bounded curves
-- in 3D space. The curve must have at least a continuity C1.
-- It can be a curve as defined in the template CurveTool from
-- It can be a curve as defined in the template CurveTool from
-- package GProp. This template gives the minimum of methods
-- required to evaluate the global properties of a curve 3D with
-- the algorithmes of GProp.
uses Pnt from gp,
Curve from BRepAdaptor,
EdgeTool from BRepGProp
uses Pnt from gp
is
Create returns Cinert;
Create returns CGProps;
Create (C : Curve from BRepAdaptor; CLocation : Pnt) returns Cinert;
Create (C : Curve; CLocation : Pnt) returns CGProps;
SetLocation(me : in out;CLocation : Pnt) ;
Perform(me : in out; C : Curve from BRepAdaptor);
Perform(me : in out; C : Curve);
end Cinert;
end CGProps;

View File

@@ -12,30 +12,33 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepGProp_Cinert.ixx>
#include <math.hxx>
#include <math_Vector.hxx>
#include <gp.hxx>
#include <gp_Vec.hxx>
#include <Standard_NotImplemented.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <BRepGProp_EdgeTool.hxx>
BRepGProp_Cinert::BRepGProp_Cinert(){}
void BRepGProp_Cinert::SetLocation(const gp_Pnt& CLocation)
GProp_CGProps::GProp_CGProps(){}
void GProp_CGProps::SetLocation(const gp_Pnt& CLocation)
{
loc = CLocation;
}
void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
void GProp_CGProps::Perform (const Curve& C)
{
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
Standard_Real Lower = BRepGProp_EdgeTool::FirstParameter (C);
Standard_Real Upper = BRepGProp_EdgeTool::LastParameter (C);
Standard_Integer Order = Min(BRepGProp_EdgeTool::IntegrationOrder (C),
math::GaussPointsMax());
Standard_Real Lower = Tool::FirstParameter (C);
Standard_Real Upper = Tool::LastParameter (C);
Standard_Integer Order = Min(Tool::IntegrationOrder (C),
math::GaussPointsMax());
gp_Pnt P; //value on the curve
gp_Vec V1; //first derivative on the curve
Standard_Real ds; //curvilign abscissae
@@ -45,18 +48,18 @@ void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
math_Vector GaussP (1, Order);
math_Vector GaussW (1, Order);
//Recuperation des points de Gauss dans le fichier GaussPoints.
math::GaussPoints (Order,GaussP);
math::GaussWeights (Order,GaussW);
// modified by NIZHNY-MKK Thu Jun 9 12:13:21 2005.BEGIN
Standard_Integer nbIntervals = BRepGProp_EdgeTool::NbIntervals(C, GeomAbs_CN);
Standard_Integer nbIntervals = Tool::NbIntervals(C, GeomAbs_CN);
Standard_Boolean bHasIntervals = (nbIntervals > 1);
TColStd_Array1OfReal TI(1, nbIntervals + 1);
if(bHasIntervals) {
BRepGProp_EdgeTool::Intervals(C, TI, GeomAbs_CN);
Tool::Intervals(C, TI, GeomAbs_CN);
}
else {
nbIntervals = 1;
@@ -64,7 +67,7 @@ void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
Standard_Integer nIndex = 0;
Standard_Real UU1 = Min(Lower, Upper);
Standard_Real UU2 = Max(Lower, Upper);
for(nIndex = 1; nIndex <= nbIntervals; nIndex++) {
if(bHasIntervals) {
Lower = Max(TI(nIndex), UU1);
@@ -77,7 +80,7 @@ void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
Standard_Real dimLocal, IxLocal, IyLocal, IzLocal, IxxLocal, IyyLocal, IzzLocal, IxyLocal, IxzLocal, IyzLocal;
dimLocal = IxLocal = IyLocal = IzLocal = IxxLocal = IyyLocal = IzzLocal = IxyLocal = IxzLocal = IyzLocal = 0.0;
// modified by NIZHNY-MKK Thu Jun 9 12:13:32 2005.END
// modified by NIZHNY-MKK Thu Jun 9 12:13:32 2005.END
loc.Coord (xloc, yloc, zloc);
@@ -89,7 +92,7 @@ void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
for (i = 1; i <= Order; i++) {
u = um + ur * GaussP (i);
BRepGProp_EdgeTool::D1 (C,u, P, V1);
Tool::D1 (C,u, P, V1);
ds = V1.Magnitude();
P.Coord (x, y, z);
x -= xloc;
@@ -136,8 +139,8 @@ void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
// modified by NIZHNY-MKK Thu Jun 9 12:13:55 2005.END
inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz),
gp_XYZ (-Ixy, Iyy, -Iyz),
gp_XYZ (-Ixz, -Iyz, Izz));
gp_XYZ (-Ixy, Iyy, -Iyz),
gp_XYZ (-Ixz, -Iyz, Izz));
if (Abs(dim) < gp::Resolution())
g = P;
@@ -146,8 +149,8 @@ void BRepGProp_Cinert::Perform (const BRepAdaptor_Curve& C)
}
BRepGProp_Cinert::BRepGProp_Cinert (const BRepAdaptor_Curve& C,
const gp_Pnt& CLocation)
GProp_CGProps::GProp_CGProps (const Curve& C,
const gp_Pnt& CLocation)
{
SetLocation(CLocation);
Perform(C);

View File

@@ -17,30 +17,30 @@
-- Jean-Claude VAUTHIER January 1992
class Sinert from BRepGProp inherits GProps
generic class SGProps from GProp ( Arc as any;
Face as any;
Domain as any)
inherits GProps
--- Purpose :
--- Purpose :
-- Computes the global properties of a face in 3D space.
-- The face 's requirements to evaluate the global properties
-- are defined in the template FaceTool from package GProp.
uses Pnt from gp,
Edge from TopoDS,
Face from BRepGProp,
Domain from BRepGProp
uses Pnt from gp
is
Create returns Sinert;
Create returns SGProps;
Create (S: Face; SLocation: Pnt) returns Sinert;
Create (S : in out Face; D : in out Domain; SLocation : Pnt) returns Sinert;
Create (S: Face; SLocation: Pnt) returns SGProps;
Create (S : in out Face; D : in out Domain; SLocation : Pnt) returns SGProps;
--- Purpose :
-- Builds a Sinert to evaluate the global properties of
-- Builds a SGProps to evaluate the global properties of
-- the face <S>. If isNaturalRestriction is true the domain of S is defined
-- with the natural bounds, else it defined with an iterator
-- of Edge from TopoDS (see DomainTool from GProp)
Create (S: in out Face; SLocation: Pnt; Eps: Real) returns Sinert;
Create (S: in out Face; D : in out Domain; SLocation: Pnt; Eps: Real) returns Sinert;
-- of Arc (see DomainTool from GProp)
Create (S: in out Face; SLocation: Pnt; Eps: Real) returns SGProps;
Create (S: in out Face; D : in out Domain; SLocation: Pnt; Eps: Real) returns SGProps;
-- --"--
-- Parameter Eps sets maximal relative error of computed area.
@@ -59,4 +59,4 @@ fields
myEpsilon: Real from Standard;
end Sinert;
end SGProps;

View File

@@ -12,9 +12,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepGProp_Sinert.ixx>
#include <Standard_NotImplemented.hxx>
#include <math_Vector.hxx>
#include <math.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Precision.hxx>
@@ -262,8 +267,8 @@ static Standard_Integer UFillIntervalBounds(Standard_Real A,
return FillIntervalBounds(A, B, Knots, U1, U2);
}
static Standard_Real CCompute(BRepGProp_Face& S,
BRepGProp_Domain& D,
static Standard_Real CCompute(Face& S,
Domain& D,
const gp_Pnt& loc,
Standard_Real& Dim,
gp_Pnt& g,
@@ -287,7 +292,7 @@ static Standard_Real CCompute(BRepGProp_Face& S,
Standard_Real x, y, z;
//boundary curve parametrization
Standard_Real l1, l2, lm, lr, l;
//BRepGProp_Face parametrization in U and V direction
//Face parametrization in U and V direction
Standard_Real BV1, BV2, v;
Standard_Real BU1, BU2, u1, u2, um, ur, u;
S.Bounds (BU1, BU2, BV1, BV2);
@@ -306,7 +311,7 @@ static Standard_Real CCompute(BRepGProp_Face& S,
loc.Coord (xloc, yloc, zloc); // use member of parent class
//Jacobien (x, y, z) -> (u, v) = ||n||
Standard_Real ds;
//On the BRepGProp_Face
//On the Face
gp_Pnt Ps;
gp_Vec VNor;
//On the boundary curve u-v
@@ -652,17 +657,17 @@ static Standard_Real CCompute(BRepGProp_Face& S,
return Eps;
}
static Standard_Real Compute(BRepGProp_Face& S, const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia,
static Standard_Real Compute(Face& S, const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia,
Standard_Real EpsDim)
{
Standard_Boolean isErrorCalculation = 0.0 > EpsDim || EpsDim < 0.001? 1: 0;
Standard_Boolean isVerifyComputation = 0.0 < EpsDim && EpsDim < 0.001? 1: 0;
EpsDim = Abs(EpsDim);
BRepGProp_Domain D;
Domain D;
return CCompute(S,D,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
}
static Standard_Real Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia,
static Standard_Real Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia,
Standard_Real EpsDim)
{
Standard_Boolean isErrorCalculation = 0.0 > EpsDim || EpsDim < 0.001? 1: 0;
@@ -671,7 +676,7 @@ static Standard_Real Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pn
return CCompute(S,D,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
}
static void Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& loc, Standard_Real& dim, gp_Pnt& g, gp_Mat& inertia)
static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, gp_Pnt& g, gp_Mat& inertia)
{
Standard_Real (*FuncAdd)(Standard_Real, Standard_Real);
Standard_Real (*FuncMul)(Standard_Real, Standard_Real);
@@ -686,11 +691,11 @@ static void Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& loc, S
Standard_Integer NbCGaussgp_Pnts = 0;
Standard_Real l1, l2, lm, lr, l; //boundary curve parametrization
Standard_Real v1, v2, v; //BRepGProp_Face parametrization in v direction
Standard_Real v1, v2, v; //Face parametrization in v direction
Standard_Real u1, u2, um, ur, u;
Standard_Real ds; //Jacobien (x, y, z) -> (u, v) = ||n||
gp_Pnt P; //On the BRepGProp_Face
gp_Pnt P; //On the Face
gp_Vec VNor;
gp_Pnt2d Puv; //On the boundary curve u-v
@@ -719,7 +724,7 @@ static void Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& loc, S
Standard_Integer NbGaussgp_Pnts = Max(NbUGaussgp_Pnts, NbVGaussgp_Pnts);
//Number of Gauss points for the integration
//on the BRepGProp_Face
//on the Face
math_Vector GaussSPV (1, NbGaussgp_Pnts);
math_Vector GaussSWV (1, NbGaussgp_Pnts);
math::GaussPoints (NbGaussgp_Pnts,GaussSPV);
@@ -831,7 +836,7 @@ static void Compute(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& loc, S
gp_XYZ (-Ixz, -Iyz, Izz));
}
static void Compute(const BRepGProp_Face& S,
static void Compute(const Face& S,
const gp_Pnt& loc,
Standard_Real& dim,
gp_Pnt& g,
@@ -962,9 +967,9 @@ static void Compute(const BRepGProp_Face& S,
gp_XYZ (-Ixz, -Iyz, Izz));
}
BRepGProp_Sinert::BRepGProp_Sinert(){}
GProp_SGProps::GProp_SGProps(){}
BRepGProp_Sinert::BRepGProp_Sinert (const BRepGProp_Face& S,
GProp_SGProps::GProp_SGProps (const Face& S,
const gp_Pnt& SLocation
)
{
@@ -972,8 +977,8 @@ BRepGProp_Sinert::BRepGProp_Sinert (const BRepGProp_Face& S,
Perform(S);
}
BRepGProp_Sinert::BRepGProp_Sinert (BRepGProp_Face& S,
BRepGProp_Domain& D,
GProp_SGProps::GProp_SGProps (Face& S,
Domain& D,
const gp_Pnt& SLocation
)
{
@@ -981,41 +986,41 @@ BRepGProp_Sinert::BRepGProp_Sinert (BRepGProp_Face& S,
Perform(S,D);
}
BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& S, const gp_Pnt& SLocation, const Standard_Real Eps){
GProp_SGProps::GProp_SGProps(Face& S, const gp_Pnt& SLocation, const Standard_Real Eps){
SetLocation(SLocation);
Perform(S, Eps);
}
BRepGProp_Sinert::BRepGProp_Sinert(BRepGProp_Face& S, BRepGProp_Domain& D, const gp_Pnt& SLocation, const Standard_Real Eps){
GProp_SGProps::GProp_SGProps(Face& S, Domain& D, const gp_Pnt& SLocation, const Standard_Real Eps){
SetLocation(SLocation);
Perform(S, D, Eps);
}
void BRepGProp_Sinert::SetLocation(const gp_Pnt& SLocation){
void GProp_SGProps::SetLocation(const gp_Pnt& SLocation){
loc = SLocation;
}
void BRepGProp_Sinert::Perform(const BRepGProp_Face& S){
void GProp_SGProps::Perform(const Face& S){
Compute(S,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void BRepGProp_Sinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D){
void GProp_SGProps::Perform(Face& S, Domain& D){
Compute(S,D,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real BRepGProp_Sinert::Perform(BRepGProp_Face& S, const Standard_Real Eps){
Standard_Real GProp_SGProps::Perform(Face& S, const Standard_Real Eps){
return myEpsilon = Compute(S,loc,dim,g,inertia,Eps);
}
Standard_Real BRepGProp_Sinert::Perform(BRepGProp_Face& S, BRepGProp_Domain& D, const Standard_Real Eps){
Standard_Real GProp_SGProps::Perform(Face& S, Domain& D, const Standard_Real Eps){
return myEpsilon = Compute(S,D,loc,dim,g,inertia,Eps);
}
Standard_Real BRepGProp_Sinert::GetEpsilon(){
Standard_Real GProp_SGProps::GetEpsilon(){
return myEpsilon;
}

View File

@@ -13,33 +13,32 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepGProp_TFunction.ixx>
#include <TColStd_HArray1OfReal.hxx>
#include <math_KronrodSingleIntegration.hxx>
#include <Precision.hxx>
#include <math.hxx>
//=======================================================================
//function : Constructor.
//purpose :
//=======================================================================
BRepGProp_TFunction::BRepGProp_TFunction(const BRepGProp_Face &theSurface,
const gp_Pnt &theVertex,
const Standard_Boolean IsByPoint,
const Standard_Address theCoeffs,
const Standard_Real theUMin,
const Standard_Real theTolerance):
mySurface(theSurface),
myUFunction(mySurface, theVertex, IsByPoint, theCoeffs),
myUMin(theUMin),
myTolerance(theTolerance),
myTolReached(0.),
myErrReached(0.),
myAbsError(0.),
myValueType(GProp_Unknown),
myIsByPoint(IsByPoint),
myNbPntOuter(3)
GProp_TFunction::GProp_TFunction(const Face &theSurface,
const gp_Pnt &theVertex,
const Standard_Boolean IsByPoint,
const Standard_Address theCoeffs,
const Standard_Real theUMin,
const Standard_Real theTolerance)
: mySurface(theSurface),
myUFunction(mySurface, theVertex, IsByPoint, theCoeffs),
myUMin(theUMin),
myTolerance(theTolerance),
myTolReached(0.),
myErrReached(0.),
myAbsError(0.),
myValueType(GProp_Unknown),
myIsByPoint(IsByPoint),
myNbPntOuter(3)
{
}
@@ -48,7 +47,7 @@ BRepGProp_TFunction::BRepGProp_TFunction(const BRepGProp_Face &theSurface,
//purpose :
//=======================================================================
void BRepGProp_TFunction::Init()
void GProp_TFunction::Init()
{
myTolReached = 0.;
myErrReached = 0.;
@@ -60,9 +59,10 @@ void BRepGProp_TFunction::Init()
//purpose :
//=======================================================================
Standard_Boolean BRepGProp_TFunction::Value(const Standard_Real X,
Standard_Real &F)
Standard_Boolean GProp_TFunction::Value(const Standard_Real X,
Standard_Real &F)
{
const Standard_Real tolU = 1.e-9;
gp_Pnt2d aP2d;
@@ -73,11 +73,10 @@ Standard_Boolean BRepGProp_TFunction::Value(const Standard_Real X,
mySurface.D12d(X, aP2d, aV2d);
aUMax = aP2d.X();
if(aUMax - myUMin < tolU)
{
if(aUMax - myUMin < tolU) {
F = 0.;
return Standard_True;
}
}
mySurface.GetUKnots(myUMin, aUMax, anUKnots);
myUFunction.SetVParam(aP2d.Y());
@@ -95,18 +94,18 @@ Standard_Boolean BRepGProp_TFunction::Value(const Standard_Real X,
if (myIsByPoint)
aCoeff /= 3.;
} else if (myValueType == GProp_CenterMassX ||
myValueType == GProp_CenterMassY ||
myValueType == GProp_CenterMassZ) {
if (myIsByPoint)
aCoeff *= 0.25;
myValueType == GProp_CenterMassY ||
myValueType == GProp_CenterMassZ) {
if (myIsByPoint)
aCoeff *= 0.25;
} else if (myValueType == GProp_InertiaXX ||
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ ||
myValueType == GProp_InertiaXY ||
myValueType == GProp_InertiaXZ ||
myValueType == GProp_InertiaYZ) {
if (myIsByPoint)
aCoeff *= 0.2;
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ ||
myValueType == GProp_InertiaXY ||
myValueType == GProp_InertiaXZ ||
myValueType == GProp_InertiaYZ) {
if (myIsByPoint)
aCoeff *= 0.2;
} else
return Standard_False;
@@ -130,12 +129,12 @@ Standard_Boolean BRepGProp_TFunction::Value(const Standard_Real X,
i = anUKnots->Lower();
F = 0.;
// Epmirical criterion
aNbPntsStart = Min(15, mySurface.UIntegrationOrder()/(anUKnots->Length() - 1)+1);
aNbPntsStart = Max(5, aNbPntsStart);
while (i < iU) {
while (i < iU) {
Standard_Real aU1 = anUKnots->Value(i++);
Standard_Real aU2 = anUKnots->Value(i);
@@ -170,14 +169,14 @@ Standard_Boolean BRepGProp_TFunction::Value(const Standard_Real X,
//purpose :
//=======================================================================
Standard_Integer BRepGProp_TFunction::GetStateNumber()
Standard_Integer GProp_TFunction::GetStateNumber()
{
//myErrReached = myTolReached;
//myTolReached = 0.;
//myNbPntOuter += RealToInt(0.5*myNbPntOuter);
//if (myNbPntOuter%2 == 0)
//myNbPntOuter++;
//myNbPntOuter++;
return 0;
}

View File

@@ -18,7 +18,7 @@
//purpose :
//=======================================================================
inline void BRepGProp_TFunction::SetNbKronrodPoints
inline void GProp_TFunction::SetNbKronrodPoints
(const Standard_Integer theNbPoints)
{
myNbPntOuter = (theNbPoints%2 == 0) ? theNbPoints + 1 : theNbPoints;
@@ -29,7 +29,7 @@ inline void BRepGProp_TFunction::SetNbKronrodPoints
//purpose :
//=======================================================================
inline void BRepGProp_TFunction::SetValueType(const GProp_ValueType theType)
inline void GProp_TFunction::SetValueType(const GProp_ValueType theType)
{
myValueType = theType;
myUFunction.SetValueType(myValueType);
@@ -40,7 +40,7 @@ inline void BRepGProp_TFunction::SetValueType(const GProp_ValueType theType)
//purpose :
//=======================================================================
inline void BRepGProp_TFunction::SetTolerance(const Standard_Real theTolerance)
inline void GProp_TFunction::SetTolerance(const Standard_Real theTolerance)
{
myTolerance = theTolerance;
}
@@ -50,7 +50,7 @@ inline void BRepGProp_TFunction::SetTolerance(const Standard_Real theTolerance)
//purpose :
//=======================================================================
inline Standard_Real BRepGProp_TFunction::ErrorReached() const
inline Standard_Real GProp_TFunction::ErrorReached() const
{
return myErrReached;
}
@@ -60,7 +60,7 @@ inline Standard_Real BRepGProp_TFunction::ErrorReached() const
//purpose :
//=======================================================================
inline Standard_Real BRepGProp_TFunction::AbsolutError() const
inline Standard_Real GProp_TFunction::AbsolutError() const
{
return myAbsError;
}

View File

@@ -13,23 +13,21 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepGProp_UFunction.ixx>
//=======================================================================
//function : Constructor.
//purpose :
//=======================================================================
BRepGProp_UFunction::BRepGProp_UFunction(const BRepGProp_Face &theSurface,
const gp_Pnt &theVertex,
const Standard_Boolean IsByPoint,
const Standard_Address theCoeffs)
: mySurface(theSurface),
myVertex(theVertex),
myCoeffs(theCoeffs),
myVParam(0.),
myValueType(GProp_Unknown),
myIsByPoint(IsByPoint)
GProp_UFunction::GProp_UFunction(const Face &theSurface,
const gp_Pnt &theVertex,
const Standard_Boolean IsByPoint,
const Standard_Address theCoeffs)
: mySurface(theSurface),
myVertex(theVertex),
myCoeffs(theCoeffs),
myVParam(0.),
myValueType(GProp_Unknown),
myIsByPoint(IsByPoint)
{
}
@@ -38,8 +36,8 @@ BRepGProp_UFunction::BRepGProp_UFunction(const BRepGProp_Face &theSurface,
//purpose : Returns a value of the function.
//=======================================================================
Standard_Boolean BRepGProp_UFunction::Value(const Standard_Real X,
Standard_Real &F)
Standard_Boolean GProp_UFunction::Value(const Standard_Real X,
Standard_Real &F)
{
// Volume computation
if (myValueType == GProp_Mass) {
@@ -54,17 +52,17 @@ Standard_Boolean BRepGProp_UFunction::Value(const Standard_Real X,
// Center of mass computation
if (myValueType == GProp_CenterMassX ||
myValueType == GProp_CenterMassY ||
myValueType == GProp_CenterMassZ)
myValueType == GProp_CenterMassY ||
myValueType == GProp_CenterMassZ)
return CenterMassValue(X, F);
// Inertia computation
if (myValueType == GProp_InertiaXX ||
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ ||
myValueType == GProp_InertiaXY ||
myValueType == GProp_InertiaXZ ||
myValueType == GProp_InertiaYZ)
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ ||
myValueType == GProp_InertiaXY ||
myValueType == GProp_InertiaXZ ||
myValueType == GProp_InertiaYZ)
return InertiaValue(X, F);
return Standard_False;
@@ -75,10 +73,10 @@ Standard_Boolean BRepGProp_UFunction::Value(const Standard_Real X,
//purpose : Returns the value for volume computation.
//=======================================================================
Standard_Real BRepGProp_UFunction::VolumeValue(const Standard_Real X,
gp_XYZ &thePMP0,
Standard_Real &theS,
Standard_Real &theD1)
Standard_Real GProp_UFunction::VolumeValue(const Standard_Real X,
gp_XYZ &thePMP0,
Standard_Real &theS,
Standard_Real &theD1)
{
gp_Pnt aPnt;
gp_Vec aNorm;
@@ -96,7 +94,7 @@ Standard_Real BRepGProp_UFunction::VolumeValue(const Standard_Real X,
theS = aNorm.X()*aCoeff[0] + aNorm.Y()*aCoeff[1] + aNorm.Z()*aCoeff[2];
theD1 = thePMP0.X()*aCoeff[0] + thePMP0.Y()*aCoeff[1]
+ thePMP0.Z()*aCoeff[2] - aCoeff[3];
+ thePMP0.Z()*aCoeff[2] - aCoeff[3];
return theS*theD1;
}
@@ -106,8 +104,8 @@ Standard_Real BRepGProp_UFunction::VolumeValue(const Standard_Real X,
//purpose : Returns a value for the center of mass computation.
//=======================================================================
Standard_Boolean BRepGProp_UFunction::CenterMassValue(const Standard_Real X,
Standard_Real &F)
Standard_Boolean GProp_UFunction::CenterMassValue(const Standard_Real X,
Standard_Real &F)
{
gp_XYZ aPmP0;
Standard_Real aS;
@@ -147,8 +145,8 @@ Standard_Boolean BRepGProp_UFunction::CenterMassValue(const Standard_Real X,
//purpose : Compute the value of intertia.
//=======================================================================
Standard_Boolean BRepGProp_UFunction::InertiaValue(const Standard_Real X,
Standard_Real &F)
Standard_Boolean GProp_UFunction::InertiaValue(const Standard_Real X,
Standard_Real &F)
{
gp_XYZ aPmP0;
Standard_Real aS;
@@ -182,8 +180,8 @@ Standard_Boolean BRepGProp_UFunction::InertiaValue(const Standard_Real X,
}
if (myValueType == GProp_InertiaXX ||
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ)
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ)
F *= aParam1*aParam1 + aParam2*aParam2;
else
F *= -aParam1*aParam2;
@@ -201,67 +199,67 @@ Standard_Boolean BRepGProp_UFunction::InertiaValue(const Standard_Real X,
// Inertia computation for XX, YY and ZZ.
if (myValueType == GProp_InertiaXX ||
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ) {
myValueType == GProp_InertiaYY ||
myValueType == GProp_InertiaZZ) {
if (myValueType == GProp_InertiaXX) {
aPPar1 = aPmP0.Y();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[1];
aCoeff2 = aCoeffs[2];
} else if (myValueType == GProp_InertiaYY) {
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[2];
} else { // myValueType == GProp_InertiaZZ
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Y();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[1];
}
if (myValueType == GProp_InertiaXX) {
aPPar1 = aPmP0.Y();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[1];
aCoeff2 = aCoeffs[2];
} else if (myValueType == GProp_InertiaYY) {
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[2];
} else { // myValueType == GProp_InertiaZZ
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Y();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[1];
}
aPPar1 -= aCoeff1*aD1;
aPPar2 -= aCoeff2*aD1;
aParam1 = aPPar1*aPPar1*aD1 + aPPar1*aCoeff1*aD2 + aCoeff1*aCoeff1*aD3;
aParam2 = aPPar2*aPPar2*aD1 + aPPar2*aCoeff2*aD2 + aCoeff2*aCoeff2*aD3;
aPPar1 -= aCoeff1*aD1;
aPPar2 -= aCoeff2*aD1;
aParam1 = aPPar1*aPPar1*aD1 + aPPar1*aCoeff1*aD2 + aCoeff1*aCoeff1*aD3;
aParam2 = aPPar2*aPPar2*aD1 + aPPar2*aCoeff2*aD2 + aCoeff2*aCoeff2*aD3;
F = (aParam1 + aParam2)*aS;
F = (aParam1 + aParam2)*aS;
return Standard_True;
return Standard_True;
}
// Inertia computation for XY, YZ and XZ.
if (myValueType == GProp_InertiaXY ||
myValueType == GProp_InertiaYZ ||
myValueType == GProp_InertiaXZ) {
myValueType == GProp_InertiaYZ ||
myValueType == GProp_InertiaXZ) {
if (myValueType == GProp_InertiaXY) {
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Y();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[1];
} else if (myValueType == GProp_InertiaYZ) {
aPPar1 = aPmP0.Y();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[1];
aCoeff2 = aCoeffs[2];
} else { // myValueType == GProp_InertiaXZ
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[2];
}
if (myValueType == GProp_InertiaXY) {
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Y();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[1];
} else if (myValueType == GProp_InertiaYZ) {
aPPar1 = aPmP0.Y();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[1];
aCoeff2 = aCoeffs[2];
} else { // myValueType == GProp_InertiaXZ
aPPar1 = aPmP0.X();
aPPar2 = aPmP0.Z();
aCoeff1 = aCoeffs[0];
aCoeff2 = aCoeffs[2];
}
aD2 *= 0.5;
aPPar1 -= aCoeff1*aD1;
aPPar2 -= aCoeff2*aD1;
aParam1 = aPPar1*aPPar2*aD1
+ (aPPar1*aCoeff2 + aPPar2*aCoeff1)*aD2 + aCoeff1*aCoeff2*aD3;
aD2 *= 0.5;
aPPar1 -= aCoeff1*aD1;
aPPar2 -= aCoeff2*aD1;
aParam1 = aPPar1*aPPar2*aD1
+ (aPPar1*aCoeff2 + aPPar2*aCoeff1)*aD2 + aCoeff1*aCoeff2*aD3;
F = -aParam1*aS;
F = -aParam1*aS;
return Standard_True;
return Standard_True;
}
return Standard_False;

View File

@@ -18,7 +18,7 @@
//purpose : Setting the type of the value to be returned.
//=======================================================================
inline void BRepGProp_UFunction::SetValueType(const GProp_ValueType theType)
inline void GProp_UFunction::SetValueType(const GProp_ValueType theType)
{
myValueType = theType;
}
@@ -29,7 +29,7 @@ inline void BRepGProp_UFunction::SetValueType(const GProp_ValueType theType)
// integral computation.
//=======================================================================
inline void BRepGProp_UFunction::SetVParam(const Standard_Real theVParam)
inline void GProp_UFunction::SetVParam(const Standard_Real theVParam)
{
myVParam = theVParam;
}

View File

@@ -17,7 +17,10 @@
-- Jean-Claude VAUTHIER January 1992
class Vinert from BRepGProp inherits GProps from GProp
generic class VGProps from GProp (Arc as any;
Face as any;
Domain as any)
inherits GProps
--- Purpose :
-- Computes the global properties of a geometric solid
@@ -34,15 +37,12 @@ class Vinert from BRepGProp inherits GProps from GProp
-- are defined in the template SurfaceTool from package GProp.
uses Pnt from gp,
Pln from gp,
Edge from TopoDS,
Face from BRepGProp,
Domain from BRepGProp
Pln from gp
is
Create returns Vinert;
Create returns VGProps;
Create (S: Face from BRepGProp; VLocation: Pnt from gp) returns Vinert;
Create (S: Face; VLocation: Pnt from gp) returns VGProps;
--- Purpose :
-- Computes the global properties of a region of 3D space
-- delimited with the surface <S> and the point VLocation. S can be closed
@@ -52,7 +52,7 @@ is
-- is used. Numbers of points depend on types of surfaces and curves.
-- Errror of the computation is not calculated.
Create (S: in out Face from BRepGProp; VLocation: Pnt from gp; Eps: Real) returns Vinert;
Create (S: in out Face; VLocation: Pnt from gp; Eps: Real) returns VGProps;
--- Purpose :
-- Computes the global properties of a region of 3D space
-- delimited with the surface <S> and the point VLocation. S can be closed
@@ -61,7 +61,7 @@ is
-- Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values
-- for two successive steps of adaptive integration.
Create (S: Face from BRepGProp; O: Pnt from gp; VLocation: Pnt from gp) returns Vinert;
Create (S: Face; O: Pnt from gp; VLocation: Pnt from gp) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the point VLocation.
@@ -71,7 +71,7 @@ is
-- is used. Numbers of points depend on types of surfaces and curves.
-- Error of the computation is not calculated.
Create (S: in out Face from BRepGProp; O: Pnt from gp; VLocation: Pnt from gp; Eps: Real) returns Vinert;
Create (S: in out Face; O: Pnt from gp; VLocation: Pnt from gp; Eps: Real) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the point VLocation.
@@ -81,7 +81,7 @@ is
-- for two successive steps of adaptive integration.
-- WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
Create (S: Face from BRepGProp; Pl: Pln from gp; VLocation: Pnt from gp) returns Vinert;
Create (S: Face; Pl: Pln from gp; VLocation: Pnt from gp) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the plane Pln.
@@ -91,7 +91,7 @@ is
-- is used. Numbers of points depend on types of surfaces and curves.
-- Error of the computation is not calculated.
Create (S: in out Face from BRepGProp; Pl: Pln from gp; VLocation: Pnt from gp; Eps: Real) returns Vinert;
Create (S: in out Face; Pl: Pln from gp; VLocation: Pnt from gp; Eps: Real) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the plane Pln.
@@ -101,9 +101,9 @@ is
-- for two successive steps of adaptive integration.
-- WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
-- With Domain from BRepGProp --
-- With Domain --
Create (S: in out Face from BRepGProp; D : in out Domain from BRepGProp; VLocation: Pnt from gp) returns Vinert;
Create (S: in out Face; D : in out Domain; VLocation: Pnt from gp) returns VGProps;
--- Purpose :
-- Computes the global properties of a region of 3D space
-- delimited with the surface <S> and the point VLocation. S can be closed
@@ -113,7 +113,7 @@ is
-- is used. Numbers of points depend on types of surfaces and curves.
-- Errror of the computation is not calculated.
Create (S: in out Face from BRepGProp; D : in out Domain from BRepGProp; VLocation: Pnt from gp; Eps: Real) returns Vinert;
Create (S: in out Face; D : in out Domain; VLocation: Pnt from gp; Eps: Real) returns VGProps;
--- Purpose :
-- Computes the global properties of a region of 3D space
-- delimited with the surface <S> and the point VLocation. S can be closed
@@ -122,7 +122,7 @@ is
-- Error is calculated as Abs((M(i+1)-M(i))/M(i+1)), M(i+1) and M(i) are values
-- for two successive steps of adaptive integration.
Create (S: in out Face from BRepGProp; D : in out Domain from BRepGProp; O: Pnt from gp; VLocation: Pnt from gp) returns Vinert;
Create (S: in out Face; D : in out Domain; O: Pnt from gp; VLocation: Pnt from gp) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the point VLocation.
@@ -132,7 +132,7 @@ is
-- is used. Numbers of points depend on types of surfaces and curves.
-- Error of the computation is not calculated.
Create (S: in out Face from BRepGProp; D : in out Domain from BRepGProp; O: Pnt from gp; VLocation: Pnt from gp; Eps: Real) returns Vinert;
Create (S: in out Face; D : in out Domain; O: Pnt from gp; VLocation: Pnt from gp; Eps: Real) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the point VLocation.
@@ -142,7 +142,7 @@ is
-- for two successive steps of adaptive integration.
-- WARNING: if Eps > 0.001 algorithm performs non-adaptive integration.
Create (S: in out Face from BRepGProp; D : in out Domain from BRepGProp; Pl: Pln from gp; VLocation: Pnt from gp) returns Vinert;
Create (S: in out Face; D : in out Domain; Pl: Pln from gp; VLocation: Pnt from gp) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the plane Pln.
@@ -152,7 +152,7 @@ is
-- is used. Numbers of points depend on types of surfaces and curves.
-- Error of the computation is not calculated.
Create (S: in out Face from BRepGProp; D : in out Domain from BRepGProp; Pl: Pln from gp; VLocation: Pnt from gp; Eps: Real) returns Vinert;
Create (S: in out Face; D : in out Domain; Pl: Pln from gp; VLocation: Pnt from gp; Eps: Real) returns VGProps;
--- Purpose :
-- Computes the global properties of the region of 3D space
-- delimited with the surface <S> and the plane Pln.
@@ -164,23 +164,23 @@ is
SetLocation(me: in out; VLocation: Pnt from gp);
Perform(me: in out; S: Face from BRepGProp);
Perform(me: in out; S: in out Face from BRepGProp; Eps: Real) returns Real;
Perform(me: in out; S: Face);
Perform(me: in out; S: in out Face; Eps: Real) returns Real;
Perform(me: in out; S: Face from BRepGProp; O : Pnt from gp);
Perform(me: in out; S: in out Face from BRepGProp; O : Pnt from gp; Eps: Real) returns Real;
Perform(me: in out; S: Face; O : Pnt from gp);
Perform(me: in out; S: in out Face; O : Pnt from gp; Eps: Real) returns Real;
Perform(me: in out; S: Face from BRepGProp; Pl : Pln from gp);
Perform(me: in out; S: in out Face from BRepGProp; Pl : Pln from gp; Eps: Real) returns Real;
Perform(me: in out; S: Face; Pl : Pln from gp);
Perform(me: in out; S: in out Face; Pl : Pln from gp; Eps: Real) returns Real;
Perform(me: in out; S: in out Face from BRepGProp; D : in out Domain from BRepGProp);
Perform(me: in out; S: in out Face from BRepGProp; D : in out Domain from BRepGProp; Eps: Real) returns Real;
Perform(me: in out; S: in out Face; D : in out Domain);
Perform(me: in out; S: in out Face; D : in out Domain; Eps: Real) returns Real;
Perform(me: in out; S: in out Face from BRepGProp; D : in out Domain from BRepGProp; O : Pnt from gp);
Perform(me: in out; S: in out Face from BRepGProp; D : in out Domain from BRepGProp; O : Pnt from gp; Eps: Real) returns Real;
Perform(me: in out; S: in out Face; D : in out Domain; O : Pnt from gp);
Perform(me: in out; S: in out Face; D : in out Domain; O : Pnt from gp; Eps: Real) returns Real;
Perform(me: in out; S: in out Face from BRepGProp; D : in out Domain from BRepGProp; Pl : Pln from gp);
Perform(me: in out; S: in out Face from BRepGProp; D : in out Domain from BRepGProp; Pl : Pln from gp; Eps: Real) returns Real;
Perform(me: in out; S: in out Face; D : in out Domain; Pl : Pln from gp);
Perform(me: in out; S: in out Face; D : in out Domain; Pl : Pln from gp; Eps: Real) returns Real;
GetEpsilon(me: out) returns Real;
--- Purpose :
@@ -190,6 +190,6 @@ fields
myEpsilon: Real from Standard;
end Vinert;
end VGProps;

970
src/GProp/GProp_VGProps.gxx Normal file
View File

@@ -0,0 +1,970 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_NotImplemented.hxx>
#include <math_Vector.hxx>
#include <math.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Precision.hxx>
class HMath_Vector{
math_Vector *pvec;
void operator=(const math_Vector&){}
public:
HMath_Vector(){ pvec = 0;}
HMath_Vector(math_Vector* pv){ pvec = pv;}
~HMath_Vector(){ if(pvec != 0) delete pvec;}
void operator=(math_Vector* pv){ if(pvec != pv && pvec != 0) delete pvec; pvec = pv;}
Standard_Real& operator()(Standard_Integer i){ return (*pvec).operator()(i);}
const Standard_Real& operator()(Standard_Integer i) const{ return (*pvec).operator()(i);}
const math_Vector* operator->() const{ return pvec;}
math_Vector* operator->(){ return pvec;}
math_Vector* Init(Standard_Real v, Standard_Integer i = 0, Standard_Integer iEnd = 0){
if(pvec == 0) return pvec;
if(iEnd - i == 0) pvec->Init(v);
else for(; i <= iEnd; i++) pvec->operator()(i) = v;
return pvec;
}
};
//Minimal value of interval's range for computation | minimal value of "dim" | ...
static Standard_Real EPS_PARAM = Precision::Angular(), EPS_DIM = 1.E-30, ERROR_ALGEBR_RATIO = 2.0/3.0;
//Maximum of GaussPoints on a subinterval and maximum of subintervals
static Standard_Integer GPM = math::GaussPointsMax(), SUBS_POWER = 32, SM = SUBS_POWER*GPM + 1;
static Standard_Boolean IS_MIN_DIM = 1; // if the value equal 0 error of algorithm calculted by static moments
static math_Vector LGaussP0(1,GPM), LGaussW0(1,GPM),
LGaussP1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM))), LGaussW1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM)));
static HMath_Vector L1 = new math_Vector(1,SM), L2 = new math_Vector(1,SM),
DimL = new math_Vector(1,SM), ErrL = new math_Vector(1,SM), ErrUL = new math_Vector(1,SM,0.0),
IxL = new math_Vector(1,SM), IyL = new math_Vector(1,SM), IzL = new math_Vector(1,SM),
IxxL = new math_Vector(1,SM), IyyL = new math_Vector(1,SM), IzzL = new math_Vector(1,SM),
IxyL = new math_Vector(1,SM), IxzL = new math_Vector(1,SM), IyzL = new math_Vector(1,SM);
static math_Vector* LGaussP[] = {&LGaussP0,&LGaussP1};
static math_Vector* LGaussW[] = {&LGaussW0,&LGaussW1};
static math_Vector UGaussP0(1,GPM), UGaussW0(1,GPM),
UGaussP1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM))), UGaussW1(1,RealToInt(Ceiling(ERROR_ALGEBR_RATIO*GPM)));
static HMath_Vector U1 = new math_Vector(1,SM), U2 = new math_Vector(1,SM),
DimU = new math_Vector(1,SM), ErrU = new math_Vector(1,SM,0.0),
IxU = new math_Vector(1,SM), IyU = new math_Vector(1,SM), IzU = new math_Vector(1,SM),
IxxU = new math_Vector(1,SM), IyyU = new math_Vector(1,SM), IzzU = new math_Vector(1,SM),
IxyU = new math_Vector(1,SM), IxzU = new math_Vector(1,SM), IyzU = new math_Vector(1,SM);
static math_Vector* UGaussP[] = {&UGaussP0,&UGaussP1};
static math_Vector* UGaussW[] = {&UGaussW0,&UGaussW1};
static Standard_Integer FillIntervalBounds(Standard_Real A, Standard_Real B, const TColStd_Array1OfReal& Knots,
HMath_Vector& VA, HMath_Vector& VB)
{
Standard_Integer i = 1, iEnd = Knots.Upper(), j = 1, k = 1;
VA(j++) = A;
for(; i <= iEnd; i++){
Standard_Real kn = Knots(i);
if(A < kn)
{
if(kn < B)
{
VA(j++) = VB(k++) = kn;
}
else
{
break;
}
}
}
VB(k) = B;
return k;
}
static inline Standard_Integer MaxSubs(Standard_Integer n, Standard_Integer coeff = SUBS_POWER){
return n = IntegerLast()/coeff < n? IntegerLast(): n*coeff + 1;
}
static Standard_Integer LFillIntervalBounds(Standard_Real A, Standard_Real B, const TColStd_Array1OfReal& Knots,
const Standard_Integer NumSubs)
{
Standard_Integer iEnd = Knots.Upper(), jEnd = L1->Upper();
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:50 2003
iEnd = Max(iEnd, MaxSubs(iEnd-1,NumSubs));
if(iEnd - 1 > jEnd){
// iEnd = MaxSubs(iEnd-1,NumSubs);
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:51 2003
L1 = new math_Vector(1,iEnd); L2 = new math_Vector(1,iEnd);
DimL = new math_Vector(1,iEnd); ErrL = new math_Vector(1,iEnd,0.0); ErrUL = new math_Vector(1,iEnd,0.0);
IxL = new math_Vector(1,iEnd); IyL = new math_Vector(1,iEnd); IzL = new math_Vector(1,iEnd);
IxxL = new math_Vector(1,iEnd); IyyL = new math_Vector(1,iEnd); IzzL = new math_Vector(1,iEnd);
IxyL = new math_Vector(1,iEnd); IxzL = new math_Vector(1,iEnd); IyzL = new math_Vector(1,iEnd);
}
return FillIntervalBounds(A, B, Knots, L1, L2);
}
static Standard_Integer UFillIntervalBounds(Standard_Real A, Standard_Real B, const TColStd_Array1OfReal& Knots,
const Standard_Integer NumSubs)
{
Standard_Integer iEnd = Knots.Upper(), jEnd = U1->Upper();
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:50 2003
iEnd = Max(iEnd, MaxSubs(iEnd-1,NumSubs));
if(iEnd - 1 > jEnd){
// iEnd = MaxSubs(iEnd-1,NumSubs);
// Modified by Sergey KHROMOV - Wed Mar 26 11:22:51 2003
U1 = new math_Vector(1,iEnd); U2 = new math_Vector(1,iEnd);
DimU = new math_Vector(1,iEnd); ErrU = new math_Vector(1,iEnd,0.0);
IxU = new math_Vector(1,iEnd); IyU = new math_Vector(1,iEnd); IzU = new math_Vector(1,iEnd);
IxxU = new math_Vector(1,iEnd); IyyU = new math_Vector(1,iEnd); IzzU = new math_Vector(1,iEnd);
IxyU = new math_Vector(1,iEnd); IxzU = new math_Vector(1,iEnd); IyzU = new math_Vector(1,iEnd);
}
return FillIntervalBounds(A, B, Knots, U1, U2);
}
static Standard_Real CCompute(Face& S, Domain& D, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia,
const Standard_Real EpsDim,
const Standard_Boolean isErrorCalculation, const Standard_Boolean isVerifyComputation)
{
Standard_Boolean isNaturalRestriction = S.NaturalRestriction();
Standard_Integer NumSubs = SUBS_POWER;
Standard_Boolean isMinDim = IS_MIN_DIM;
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
Dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
//boundary curve parametrization
Standard_Real l1, l2, lm, lr, l;
//Face parametrization in U and V direction
Standard_Real BV1, BV2, v;
Standard_Real BU1, BU2, u1, u2, um, ur, u;
S.Bounds (BU1, BU2, BV1, BV2); u1 = BU1;
//location point used to compute the inertia
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
//location point used to compute the inertiard (xloc, yloc, zloc);
//Jacobien (x, y, z) -> (u, v) = ||n||
Standard_Real xn, yn, zn, s, ds, dDim;
Standard_Real x, y, z, xi, px, py, pz, yi, zi, d1, d2, d3;
//On the Face
gp_Pnt Ps;
gp_Vec VNor;
//On the boundary curve u-v
gp_Pnt2d Puv;
gp_Vec2d Vuv;
Standard_Real Dul; // Dul = Du / Dl
Standard_Real CDim[2], CIx, CIy, CIz, CIxx[2], CIyy[2], CIzz[2], CIxy, CIxz, CIyz;
Standard_Real LocDim[2], LocIx[2], LocIy[2], LocIz[2], LocIxx[2], LocIyy[2], LocIzz[2], LocIxy[2], LocIxz[2], LocIyz[2];
Standard_Integer iD = 0, NbLSubs, iLS, iLSubEnd, iGL, iGLEnd, NbLGaussP[2], LRange[2], iL, kL, kLEnd, IL, JL;
Standard_Integer i, NbUSubs, iUS, iUSubEnd, iGU, iGUEnd, NbUGaussP[2], URange[2], iU, kU, kUEnd, IU, JU;
Standard_Integer UMaxSubs, LMaxSubs;
Standard_Real ErrorU, ErrorL, ErrorLMax = 0.0, Eps=0.0, EpsL=0.0, EpsU=0.0;
iGLEnd = isErrorCalculation? 2: 1;
for(i = 0; i < 2; i++) {
LocDim[i] = 0.0;
LocIx[i] = 0.0;
LocIy[i] = 0.0;
LocIz[i] = 0.0;
LocIxx[i] = 0.0;
LocIyy[i] = 0.0;
LocIzz[i] = 0.0;
LocIxy[i] = 0.0;
LocIyz[i] = 0.0;
LocIxz[i] = 0.0;
}
NbUGaussP[0] = S.SIntOrder(EpsDim);
NbUGaussP[1] = RealToInt(Ceiling(ERROR_ALGEBR_RATIO*NbUGaussP[0]));
math::GaussPoints(NbUGaussP[0],UGaussP0); math::GaussWeights(NbUGaussP[0],UGaussW0);
math::GaussPoints(NbUGaussP[1],UGaussP1); math::GaussWeights(NbUGaussP[1],UGaussW1);
NbUSubs = S.SUIntSubs();
TColStd_Array1OfReal UKnots(1,NbUSubs+1);
S.UKnots(UKnots);
while (isNaturalRestriction || D.More()) {
if(isNaturalRestriction){
NbLGaussP[0] = Min(2*NbUGaussP[0],math::GaussPointsMax());
}else{
S.Load(D.Value()); ++iD;
NbLGaussP[0] = S.LIntOrder(EpsDim);
}
NbLGaussP[1] = RealToInt(Ceiling(ERROR_ALGEBR_RATIO*NbLGaussP[0]));
math::GaussPoints(NbLGaussP[0],LGaussP0); math::GaussWeights(NbLGaussP[0],LGaussW0);
math::GaussPoints(NbLGaussP[1],LGaussP1); math::GaussWeights(NbLGaussP[1],LGaussW1);
NbLSubs = isNaturalRestriction? S.SVIntSubs(): S.LIntSubs();
TColStd_Array1OfReal LKnots(1,NbLSubs+1);
if(isNaturalRestriction){
S.VKnots(LKnots);
l1 = BV1; l2 = BV2;
}else{
S.LKnots(LKnots);
l1 = S.FirstParameter(); l2 = S.LastParameter();
}
ErrorL = 0.0;
kLEnd = 1; JL = 0;
//OCC503(apo): if(Abs(l2-l1) < EPS_PARAM) continue;
if(Abs(l2-l1) > EPS_PARAM) {
iLSubEnd = LFillIntervalBounds(l1, l2, LKnots, NumSubs);
LMaxSubs = MaxSubs(iLSubEnd);
//-- exception avoiding
if(LMaxSubs > SM) LMaxSubs = SM;
DimL.Init(0.0,1,LMaxSubs); ErrL.Init(0.0,1,LMaxSubs); ErrUL.Init(0.0,1,LMaxSubs);
do{// while: L
if(++JL > iLSubEnd){
LRange[0] = IL = ErrL->Max(); LRange[1] = JL;
L1(JL) = (L1(IL) + L2(IL))/2.0; L2(JL) = L2(IL); L2(IL) = L1(JL);
}else LRange[0] = IL = JL;
if(JL == LMaxSubs || Abs(L2(JL) - L1(JL)) < EPS_PARAM)
if(kLEnd == 1){
DimL(JL) = ErrL(JL) = IxL(JL) = IyL(JL) = IzL(JL) =
IxxL(JL) = IyyL(JL) = IzzL(JL) = IxyL(JL) = IxzL(JL) = IyzL(JL) = 0.0;
}else{
JL--;
EpsL = ErrorL; Eps = EpsL/0.9;
break;
}
else
for(kL=0; kL < kLEnd; kL++){
iLS = LRange[kL];
lm = 0.5*(L2(iLS) + L1(iLS));
lr = 0.5*(L2(iLS) - L1(iLS));
CIx = CIy = CIz = CIxy = CIxz = CIyz = 0.0;
for(iGL=0; iGL < iGLEnd; iGL++){//
CDim[iGL] = CIxx[iGL] = CIyy[iGL] = CIzz[iGL] = 0.0;
for(iL=1; iL<=NbLGaussP[iGL]; iL++){
l = lm + lr*(*LGaussP[iGL])(iL);
if(isNaturalRestriction){
v = l; u2 = BU2; Dul = (*LGaussW[iGL])(iL);
}else{
S.D12d (l, Puv, Vuv);
Dul = Vuv.Y()*(*LGaussW[iGL])(iL); // Dul = Du / Dl
if(Abs(Dul) < EPS_PARAM) continue;
v = Puv.Y(); u2 = Puv.X();
//Check on cause out off bounds of value current parameter
if(v < BV1) v = BV1; else if(v > BV2) v = BV2;
if(u2 < BU1) u2 = BU1; else if(u2 > BU2) u2 = BU2;
}
ErrUL(iLS) = 0.0;
kUEnd = 1; JU = 0;
if(Abs(u2-u1) < EPS_PARAM) continue;
iUSubEnd = UFillIntervalBounds(u1, u2, UKnots, NumSubs);
UMaxSubs = MaxSubs(iUSubEnd);
//-- exception avoiding
if(UMaxSubs > SM) UMaxSubs = SM;
DimU.Init(0.0,1,UMaxSubs); ErrU.Init(0.0,1,UMaxSubs); ErrorU = 0.0;
do{//while: U
if(++JU > iUSubEnd){
URange[0] = IU = ErrU->Max(); URange[1] = JU;
U1(JU) = (U1(IU)+U2(IU))/2.0; U2(JU) = U2(IU); U2(IU) = U1(JU);
}else URange[0] = IU = JU;
if(JU == UMaxSubs || Abs(U2(JU) - U1(JU)) < EPS_PARAM)
if(kUEnd == 1){
DimU(JU) = ErrU(JU) = IxU(JU) = IyU(JU) = IzU(JU) =
IxxU(JU) = IyyU(JU) = IzzU(JU) = IxyU(JU) = IxzU(JU) = IyzU(JU) = 0.0;
}else{
JU--;
EpsU = ErrorU; Eps = EpsU*Abs((u2-u1)*Dul)/0.1; EpsL = 0.9*Eps;
break;
}
else
for(kU=0; kU < kUEnd; kU++){
iUS = URange[kU];
um = 0.5*(U2(iUS) + U1(iUS));
ur = 0.5*(U2(iUS) - U1(iUS));
iGUEnd = iGLEnd - iGL;
for(iGU=0; iGU < iGUEnd; iGU++){//
LocDim[iGU] =
LocIxx[iGU] = LocIyy[iGU] = LocIzz[iGU] =
LocIx[iGU] = LocIy[iGU] = LocIz[iGU] =
LocIxy[iGU] = LocIxz[iGU] = LocIyz[iGU] = 0.0;
for(iU=1; iU<=NbUGaussP[iGU]; iU++){
u = um + ur*(*UGaussP[iGU])(iU);
S.Normal(u, v, Ps, VNor);
VNor.Coord(xn, yn, zn);
Ps.Coord(x, y, z);
x -= xloc; y -= yloc; z -= zloc;
xn *= (*UGaussW[iGU])(iU);
yn *= (*UGaussW[iGU])(iU);
zn *= (*UGaussW[iGU])(iU);
if(ByPoint){
//volume of elementary cone
dDim = (x*xn+y*yn+z*zn)/3.0;
//coordinates of cone's center mass
px = 0.75*x; py = 0.75*y; pz = 0.75*z;
LocDim[iGU] += dDim;
//if(iGU > 0) continue;
LocIx[iGU] += px*dDim;
LocIy[iGU] += py*dDim;
LocIz[iGU] += pz*dDim;
x -= Coeff[0]; y -= Coeff[1]; z -= Coeff[2];
dDim *= 3.0/5.0;
LocIxy[iGU] -= x*y*dDim;
LocIyz[iGU] -= y*z*dDim;
LocIxz[iGU] -= x*z*dDim;
xi = x*x; yi = y*y; zi = z*z;
LocIxx[iGU] += (yi+zi)*dDim;
LocIyy[iGU] += (xi+zi)*dDim;
LocIzz[iGU] += (xi+yi)*dDim;
}else{ // by plane
s = xn*Coeff[0] + yn*Coeff[1] + zn*Coeff[2];
d1 = Coeff[0]*x + Coeff[1]*y + Coeff[2]*z - Coeff[3];
d2 = d1*d1;
d3 = d1*d2/3.0;
ds = s*d1;
LocDim[iGU] += ds;
//if(iGU > 0) continue;
LocIx[iGU] += (x - Coeff[0]*d1/2.0) * ds;
LocIy[iGU] += (y - Coeff[1]*d1/2.0) * ds;
LocIz[iGU] += (z - Coeff[2]*d1/2.0) * ds;
px = x-Coeff[0]*d1; py = y-Coeff[1]*d1; pz = z-Coeff[2]*d1;
xi = px*px*d1 + px*Coeff[0]*d2 + Coeff[0]*Coeff[0]*d3;
yi = py*py*d1 + py*Coeff[1]*d2 + Coeff[1]*Coeff[1]*d3;
zi = pz*pz*d1 + pz*Coeff[2]*d2 + Coeff[2]*Coeff[2]*d3;
LocIxx[iGU] += (yi+zi)*s;
LocIyy[iGU] += (xi+zi)*s;
LocIzz[iGU] += (xi+yi)*s;
d2 /= 2.0;
xi = py*pz*d1 + py*Coeff[2]*d2 + pz*Coeff[1]*d2 + Coeff[1]*Coeff[2]*d3;
yi = px*pz*d1 + pz*Coeff[0]*d2 + px*Coeff[2]*d2 + Coeff[0]*Coeff[2]*d3;
zi = px*py*d1 + px*Coeff[1]*d2 + py*Coeff[0]*d2 + Coeff[0]*Coeff[1]*d3;
LocIxy[iGU] -= zi*s; LocIyz[iGU] -= xi*s; LocIxz[iGU] -= yi*s;
}
}//for: iU
}//for: iGU
DimU(iUS) = LocDim[0]*ur;
IxxU(iUS) = LocIxx[0]*ur; IyyU(iUS) = LocIyy[0]*ur; IzzU(iUS) = LocIzz[0]*ur;
if(iGL > 0) continue;
LocDim[1] = Abs(LocDim[1]-LocDim[0]);
LocIxx[1] = Abs(LocIxx[1]-LocIxx[0]);
LocIyy[1] = Abs(LocIyy[1]-LocIyy[0]);
LocIzz[1] = Abs(LocIzz[1]-LocIzz[0]);
ErrU(iUS) = isMinDim? LocDim[1]*ur: (LocIxx[1] + LocIyy[1] + LocIzz[1])*ur;
IxU(iUS) = LocIx[0]*ur; IyU(iUS) = LocIy[0]*ur; IzU(iUS) = LocIz[0]*ur;
IxyU(iUS) = LocIxy[0]*ur; IxzU(iUS) = LocIxz[0]*ur; IyzU(iUS) = LocIyz[0]*ur;
}//for: kU (iUS)
if(JU == iUSubEnd) kUEnd = 2;
if(kUEnd == 2) {
Standard_Integer imax = ErrU->Max();
if(imax > 0) ErrorU = ErrU(imax);
else ErrorU = 0.0;
}
}while((ErrorU - EpsU > 0.0 && EpsU != 0.0) || kUEnd == 1);
for(i=1; i<=JU; i++) {
CDim[iGL] += DimU(i)*Dul;
CIxx[iGL] += IxxU(i)*Dul; CIyy[iGL] += IyyU(i)*Dul; CIzz[iGL] += IzzU(i)*Dul;
}
if(iGL > 0) continue;
ErrUL(iLS) = ErrorU*Abs((u2-u1)*Dul);
for(i=1; i<=JU; i++){
CIx += IxU(i)*Dul; CIy += IyU(i)*Dul; CIz += IzU(i)*Dul;
//CIxx += IxxU(i)*Dul; CIyy += IyyU(i)*Dul; CIzz += IzzU(i)*Dul;
CIxy += IxyU(i)*Dul; CIxz += IxzU(i)*Dul; CIyz += IyzU(i)*Dul;
}
}//for: iL
}//for: iGL
DimL(iLS) = CDim[0]*lr;
IxxL(iLS) = CIxx[0]*lr; IyyL(iLS) = CIyy[0]*lr; IzzL(iLS) = CIzz[0]*lr;
if(iGLEnd == 2) {
//ErrL(iLS) = Abs(CDim[1]-CDim[0])*lr + ErrUL(iLS);
CDim[1] = Abs(CDim[1]-CDim[0]);
CIxx[1] = Abs(CIxx[1]-CIxx[0]); CIyy[1] = Abs(CIyy[1]-CIyy[0]); CIzz[1] = Abs(CIzz[1]-CIzz[0]);
ErrorU = ErrUL(iLS);
ErrL(iLS) = (isMinDim? CDim[1]: (CIxx[1] + CIyy[1] + CIzz[1]))*lr + ErrorU;
}
IxL(iLS) = CIx*lr; IyL(iLS) = CIy*lr; IzL(iLS) = CIz*lr;
//IxxL(iLS) = CIxx*lr; IyyL(iLS) = CIyy*lr; IzzL(iLS) = CIzz*lr;
IxyL(iLS) = CIxy*lr; IxzL(iLS) = CIxz*lr; IyzL(iLS) = CIyz*lr;
}//for: (kL)iLS
// Calculate/correct epsilon of computation by current value of Dim
//That is need for not spend time for
if(JL == iLSubEnd){
kLEnd = 2;
Standard_Real DDim = 0.0, DIxx = 0.0, DIyy = 0.0, DIzz = 0.0;
for(i=1; i<=JL; i++) {
DDim += DimL(i);
DIxx += IxxL(i); DIyy += IyyL(i); DIzz += IzzL(i);
}
DDim = isMinDim? Abs(DDim): Abs(DIxx) + Abs(DIyy) + Abs(DIzz);
DDim = Abs(DDim*EpsDim);
if(DDim > Eps) {
Eps = DDim; EpsL = 0.9*Eps;
}
}
if(kLEnd == 2) {
Standard_Integer imax = ErrL->Max();
if(imax > 0) ErrorL = ErrL(imax);
else ErrorL = 0.0;
}
}while((ErrorL - EpsL > 0.0 && isVerifyComputation) || kLEnd == 1);
for(i=1; i<=JL; i++){
Dim += DimL(i);
Ix += IxL(i); Iy += IyL(i); Iz += IzL(i);
Ixx += IxxL(i); Iyy += IyyL(i); Izz += IzzL(i);
Ixy += IxyL(i); Ixz += IxzL(i); Iyz += IyzL(i);
}
ErrorLMax = Max(ErrorLMax, ErrorL);
}
if(isNaturalRestriction) break;
D.Next();
}
if(Abs(Dim) >= EPS_DIM){
if(ByPoint){
Ix = Coeff[0] + Ix/Dim;
Iy = Coeff[1] + Iy/Dim;
Iz = Coeff[2] + Iz/Dim;
}else{
Ix /= Dim;
Iy /= Dim;
Iz /= Dim;
}
g.SetCoord (Ix, Iy, Iz);
}else{
Dim =0.;
g.SetCoord(0.,0.,0.);
}
inertia.SetCols (gp_XYZ (Ixx, Ixy, Ixz),
gp_XYZ (Ixy, Iyy, Iyz),
gp_XYZ (Ixz, Iyz, Izz));
if(iGLEnd == 2)
Eps = Dim != 0.0? ErrorLMax/(isMinDim? Abs(Dim): (Abs(Ixx) + Abs(Iyy) + Abs(Izz))): 0.0;
else Eps = EpsDim;
return Eps;
}
static Standard_Real Compute(Face& S, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia, Standard_Real EpsDim)
{
Standard_Boolean isErrorCalculation = 0.0 > EpsDim || EpsDim < 0.001? 1: 0;
Standard_Boolean isVerifyComputation = 0.0 < EpsDim && EpsDim < 0.001? 1: 0;
EpsDim = Abs(EpsDim);
Domain D;
return CCompute(S,D,ByPoint,Coeff,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
}
static Standard_Real Compute(Face& S, Domain& D, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& loc, Standard_Real& Dim, gp_Pnt& g, gp_Mat& inertia, Standard_Real EpsDim)
{
Standard_Boolean isErrorCalculation = 0.0 > EpsDim || EpsDim < 0.001? 1: 0;
Standard_Boolean isVerifyComputation = 0.0 < EpsDim && EpsDim < 0.001? 1: 0;
EpsDim = Abs(EpsDim);
return CCompute(S,D,ByPoint,Coeff,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
}
static void Compute(const Face& S,
const Standard_Boolean ByPoint,
const Standard_Real Coeff[],
const gp_Pnt& Loc,
Standard_Real& Volu,
gp_Pnt& G,
gp_Mat& Inertia)
{
gp_Pnt P;
gp_Vec VNor;
Standard_Real dvi, dv;
Standard_Real ur, um, u, vr, vm, v;
Standard_Real x, y, z, xn, yn, zn, xi, yi, zi;
// Standard_Real x, y, z, xn, yn, zn, xi, yi, zi, xyz;
Standard_Real px,py,pz,s,d1,d2,d3;
Standard_Real Ixi, Iyi, Izi, Ixxi, Iyyi, Izzi, Ixyi, Ixzi, Iyzi;
Standard_Real xloc, yloc, zloc;
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
Volu = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
Loc.Coord (xloc, yloc, zloc);
Standard_Real LowerU, UpperU, LowerV, UpperV;
S.Bounds ( LowerU, UpperU, LowerV, UpperV);
Standard_Integer UOrder = Min(S.UIntegrationOrder (),
math::GaussPointsMax());
Standard_Integer VOrder = Min(S.VIntegrationOrder (),
math::GaussPointsMax());
Standard_Integer i, j;
math_Vector GaussPU (1, UOrder); //gauss points and weights
math_Vector GaussWU (1, UOrder);
math_Vector GaussPV (1, VOrder);
math_Vector GaussWV (1, VOrder);
math::GaussPoints (UOrder,GaussPU);
math::GaussWeights (UOrder,GaussWU);
math::GaussPoints (VOrder,GaussPV);
math::GaussWeights (VOrder,GaussWV);
um = 0.5 * (UpperU + LowerU);
vm = 0.5 * (UpperV + LowerV);
ur = 0.5 * (UpperU - LowerU);
vr = 0.5 * (UpperV - LowerV);
for (j = 1; j <= VOrder; j++) {
v = vm + vr * GaussPV (j);
dvi = Ixi = Iyi = Izi = Ixxi = Iyyi = Izzi = Ixyi = Ixzi = Iyzi = 0.0;
for (i = 1; i <= UOrder; i++) {
u = um + ur * GaussPU (i);
S.Normal (u, v, P, VNor);
VNor.Coord (xn, yn, zn);
P.Coord (x, y, z);
x -= xloc; y -= yloc; z -= zloc;
xn *= GaussWU (i); yn *= GaussWU (i); zn *= GaussWU (i);
if (ByPoint) {
///////////////////// ///////////////////////
// OFV code // // Initial code //
///////////////////// ///////////////////////
// modified by APO
dv = (x*xn+y*yn+z*zn)/3.0; //xyz = x * y * z;
dvi += dv; //Ixyi += zn * xyz;
Ixi += 0.75*x*dv; //Iyzi += xn * xyz;
Iyi += 0.75*y*dv; //Ixzi += yn * xyz;
Izi += 0.75*z*dv; //xi = x * x * x * xn / 3.0;
x -= Coeff[0]; //yi = y * y * y * yn / 3.0;
y -= Coeff[1]; //zi = z * z * z * zn / 3.0;
z -= Coeff[2]; //Ixxi += (yi + zi);
dv *= 3.0/5.0; //Iyyi += (xi + zi);
Ixyi -= x*y*dv; //Izzi += (xi + yi);
Iyzi -= y*z*dv; //x -= Coeff[0];
Ixzi -= x*z*dv; //y -= Coeff[1];
xi = x*x; //z -= Coeff[2];
yi = y*y; //dv = x * xn + y * yn + z * zn;
zi = z*z; //dvi += dv;
Ixxi += (yi + zi)*dv; //Ixi += x * dv;
Iyyi += (xi + zi)*dv; //Iyi += y * dv;
Izzi += (xi + yi)*dv; //Izi += z * dv;
}
else { // by plane
s = xn * Coeff[0] + yn * Coeff[1] + zn * Coeff[2];
d1 = Coeff[0] * x + Coeff[1] * y + Coeff[2] * z - Coeff[3];
d2 = d1 * d1;
d3 = d1 * d2 / 3.0;
dv = s * d1;
dvi += dv;
Ixi += (x - (Coeff[0] * d1 / 2.0)) * dv;
Iyi += (y - (Coeff[1] * d1 / 2.0)) * dv;
Izi += (z - (Coeff[2] * d1 / 2.0)) * dv;
px = x - Coeff[0] * d1;
py = y - Coeff[1] * d1;
pz = z - Coeff[2] * d1;
xi = px * px * d1 + px * Coeff[0]* d2 + Coeff[0] * Coeff[0] * d3;
yi = py * py * d1 + py * Coeff[1] * d2 + Coeff[1] * Coeff[1] * d3;
zi = pz * pz * d1 + pz * Coeff[2] * d2 + Coeff[2] * Coeff[2] * d3;
Ixxi += (yi + zi) * s;
Iyyi += (xi + zi) * s;
Izzi += (xi + yi) * s;
d2 /= 2.0;
xi = (py * pz * d1) + (py * Coeff[2] * d2) + (pz * Coeff[1] * d2) + (Coeff[1] * Coeff[2] * d3);
yi = (px * pz * d1) + (pz * Coeff[0] * d2) + (px * Coeff[2] * d2) + (Coeff[0] * Coeff[2] * d3);
zi = (px * py * d1) + (px * Coeff[1] * d2) + (py * Coeff[0] * d2) + (Coeff[0] * Coeff[1] * d3);
Ixyi -= zi * s;
Iyzi -= xi * s;
Ixzi -= yi * s;
}
}
Volu += dvi * GaussWV (j);
Ix += Ixi * GaussWV (j);
Iy += Iyi * GaussWV (j);
Iz += Izi * GaussWV (j);
Ixx += Ixxi * GaussWV (j);
Iyy += Iyyi * GaussWV (j);
Izz += Izzi * GaussWV (j);
Ixy += Ixyi * GaussWV (j);
Ixz += Ixzi * GaussWV (j);
Iyz += Iyzi * GaussWV (j);
}
vr *= ur;
Ixx *= vr;
Iyy *= vr;
Izz *= vr;
Ixy *= vr;
Ixz *= vr;
Iyz *= vr;
if (Abs(Volu) >= EPS_DIM ) {
if (ByPoint) {
Ix = Coeff[0] + Ix/Volu;
Iy = Coeff[1] + Iy/Volu;
Iz = Coeff[2] + Iz/Volu;
Volu *= vr;
}
else { //by plane
Ix /= Volu;
Iy /= Volu;
Iz /= Volu;
Volu *= vr;
}
G.SetCoord (Ix, Iy, Iz);
}
else {
G.SetCoord(0.,0.,0.);
Volu =0.;
}
Inertia.SetCols (gp_XYZ (Ixx, Ixy, Ixz),
gp_XYZ (Ixy, Iyy, Iyz),
gp_XYZ (Ixz, Iyz, Izz));
}
// Last modified by OFV 5.2001:
// 1). surface and edge integration order is equal now
// 2). "by point" works now rathre correctly (it looks so...)
static void Compute(Face& S, Domain& D, const Standard_Boolean ByPoint, const Standard_Real Coeff[],
const gp_Pnt& Loc, Standard_Real& Volu, gp_Pnt& G, gp_Mat& Inertia)
{
Standard_Real x, y, z, xi, yi, zi, l1, l2, lm, lr, l, v1, v2, v, u1, u2, um, ur, u, ds, Dul, xloc, yloc, zloc;
Standard_Real LocVolu, LocIx, LocIy, LocIz, LocIxx, LocIyy, LocIzz, LocIxy, LocIxz, LocIyz;
Standard_Real CVolu, CIx, CIy, CIz, CIxx, CIyy, CIzz, CIxy, CIxz, CIyz, Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
Standard_Real xn, yn, zn, px, py, pz, s, d1, d2, d3, dSigma;
Standard_Integer i, j, vio, sio, max, NbGaussgp_Pnts;
gp_Pnt Ps;
gp_Vec VNor;
gp_Pnt2d Puv;
gp_Vec2d Vuv;
Loc.Coord (xloc, yloc, zloc);
Volu = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
S.Bounds (u1, u2, v1, v2);
Standard_Real _u2 = u2; //OCC104
vio = S.VIntegrationOrder ();
while (D.More())
{
S.Load(D.Value());
sio = S.IntegrationOrder ();
max = Max(vio,sio);
NbGaussgp_Pnts = Min(max,math::GaussPointsMax());
math_Vector GaussP (1, NbGaussgp_Pnts);
math_Vector GaussW (1, NbGaussgp_Pnts);
math::GaussPoints (NbGaussgp_Pnts,GaussP);
math::GaussWeights (NbGaussgp_Pnts,GaussW);
CVolu = CIx = CIy = CIz = CIxx = CIyy = CIzz = CIxy = CIxz = CIyz = 0.0;
l1 = S.FirstParameter();
l2 = S.LastParameter();
lm = 0.5 * (l2 + l1);
lr = 0.5 * (l2 - l1);
for (i=1; i<=NbGaussgp_Pnts; i++)
{
l = lm + lr * GaussP(i);
S.D12d (l, Puv, Vuv);
v = Puv.Y();
u2 = Puv.X();
//OCC104
v = v < v1? v1: v;
v = v > v2? v2: v;
u2 = u2 < u1? u1: u2;
u2 = u2 > _u2? _u2: u2;
Dul = Vuv.Y() * GaussW(i);
um = 0.5 * (u2 + u1);
ur = 0.5 * (u2 - u1);
LocVolu = LocIx = LocIy = LocIz = LocIxx = LocIyy = LocIzz = LocIxy = LocIxz = LocIyz = 0.0;
for (j=1; j<=NbGaussgp_Pnts; j++)
{
u = um + ur * GaussP(j);
S.Normal (u, v, Ps, VNor);
VNor.Coord (xn, yn, zn);
Ps.Coord (x, y, z);
x -= xloc;
y -= yloc;
z -= zloc;
xn = xn * Dul * GaussW(j);
yn = yn * Dul * GaussW(j);
zn = zn * Dul * GaussW(j);
if(ByPoint)
{
dSigma = (x*xn+y*yn+z*zn)/3.0;
LocVolu += dSigma;
LocIx += 0.75*x*dSigma;
LocIy += 0.75*y*dSigma;
LocIz += 0.75*z*dSigma;
x -= Coeff[0];
y -= Coeff[1];
z -= Coeff[2];
dSigma *= 3.0/5.0;
LocIxy -= x*y*dSigma;
LocIyz -= y*z*dSigma;
LocIxz -= x*z*dSigma;
xi = x*x;
yi = y*y;
zi = z*z;
LocIxx += (yi + zi)*dSigma;
LocIyy += (xi + zi)*dSigma;
LocIzz += (xi + yi)*dSigma;
}
else
{
s = xn * Coeff[0] + yn * Coeff[1] + zn * Coeff[2];
d1 = Coeff[0] * x + Coeff[1] * y + Coeff[2] * z;
d2 = d1 * d1;
d3 = d1 * d2 / 3.0;
ds = s * d1;
LocVolu += ds;
LocIx += (x - Coeff[0] * d1 / 2.0) * ds;
LocIy += (y - Coeff[1] * d1 / 2.0) * ds;
LocIz += (z - Coeff[2] * d1 / 2.0) * ds;
px = x - Coeff[0] * d1;
py = y - Coeff[1] * d1;
pz = z - Coeff[2] * d1;
xi = (px * px * d1) + (px * Coeff[0]* d2) + (Coeff[0] * Coeff[0] * d3);
yi = (py * py * d1) + (py * Coeff[1] * d2) + (Coeff[1] * Coeff[1] * d3);
zi = pz * pz * d1 + pz * Coeff[2] * d2 + (Coeff[2] * Coeff[2] * d3);
LocIxx += (yi + zi) * s;
LocIyy += (xi + zi) * s;
LocIzz += (xi + yi) * s;
d2 /= 2.0;
xi = (py * pz * d1) + (py * Coeff[2] * d2) + (pz * Coeff[1] * d2) + (Coeff[1] * Coeff[2] * d3);
yi = (px * pz * d1) + (pz * Coeff[0] * d2) + (px * Coeff[2] * d2) + (Coeff[0] * Coeff[2] * d3);
zi = (px * py * d1) + (px * Coeff[1] * d2) + (py * Coeff[0] * d2) + (Coeff[0] * Coeff[1] * d3);
LocIxy -= zi * s;
LocIyz -= xi * s;
LocIxz -= yi * s;
}
}
CVolu += LocVolu * ur;
CIx += LocIx * ur;
CIy += LocIy * ur;
CIz += LocIz * ur;
CIxx += LocIxx * ur;
CIyy += LocIyy * ur;
CIzz += LocIzz * ur;
CIxy += LocIxy * ur;
CIxz += LocIxz * ur;
CIyz += LocIyz * ur;
}
Volu += CVolu * lr;
Ix += CIx * lr;
Iy += CIy * lr;
Iz += CIz * lr;
Ixx += CIxx * lr;
Iyy += CIyy * lr;
Izz += CIzz * lr;
Ixy += CIxy * lr;
Ixz += CIxz * lr;
Iyz += CIyz * lr;
D.Next();
}
if(Abs(Volu) >= EPS_DIM)
{
if(ByPoint)
{
Ix = Coeff[0] + Ix/Volu;
Iy = Coeff[1] + Iy/Volu;
Iz = Coeff[2] + Iz/Volu;
}
else
{
Ix /= Volu;
Iy /= Volu;
Iz /= Volu;
}
G.SetCoord (Ix, Iy, Iz);
}
else
{
Volu =0.;
G.SetCoord(0.,0.,0.);
}
Inertia.SetCols (gp_XYZ (Ixx, Ixy, Ixz),
gp_XYZ (Ixy, Iyy, Iyz),
gp_XYZ (Ixz, Iyz, Izz));
}
GProp_VGProps::GProp_VGProps(){}
GProp_VGProps::GProp_VGProps(Face& S, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,Eps);
}
GProp_VGProps::GProp_VGProps(Face& S, Domain& D, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,D,Eps);
}
GProp_VGProps::GProp_VGProps(Face& S, Domain& D, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,D);
}
GProp_VGProps::GProp_VGProps(const Face& S, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S);
}
GProp_VGProps::GProp_VGProps(Face& S, const gp_Pnt& O, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,O,Eps);
}
GProp_VGProps::GProp_VGProps(Face& S, Domain& D, const gp_Pnt& O, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,D,O,Eps);
}
GProp_VGProps::GProp_VGProps(const Face& S, const gp_Pnt& O, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,O);
}
GProp_VGProps::GProp_VGProps(Face& S, Domain& D, const gp_Pnt& O, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,D,O);
}
GProp_VGProps::GProp_VGProps(Face& S, const gp_Pln& Pl, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,Pl,Eps);
}
GProp_VGProps::GProp_VGProps(Face& S, Domain& D, const gp_Pln& Pl, const gp_Pnt& VLocation, const Standard_Real Eps){
SetLocation(VLocation);
Perform(S,D,Pl,Eps);
}
GProp_VGProps::GProp_VGProps(const Face& S, const gp_Pln& Pl, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,Pl);
}
GProp_VGProps::GProp_VGProps(Face& S, Domain& D, const gp_Pln& Pl, const gp_Pnt& VLocation){
SetLocation(VLocation);
Perform(S,D,Pl);
}
void GProp_VGProps::SetLocation(const gp_Pnt& VLocation){
loc = VLocation;
}
Standard_Real GProp_VGProps::Perform(Face& S, const Standard_Real Eps){
Standard_Real Coeff[] = {0., 0., 0.};
return myEpsilon = Compute(S,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
Standard_Real GProp_VGProps::Perform(Face& S, Domain& D, const Standard_Real Eps){
Standard_Real Coeff[] = {0., 0., 0.};
return myEpsilon = Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
void GProp_VGProps::Perform(const Face& S){
Standard_Real Coeff[] = {0., 0., 0.};
Compute(S,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void GProp_VGProps::Perform(Face& S, Domain& D){
Standard_Real Coeff[] = {0., 0., 0.};
Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real GProp_VGProps::Perform(Face& S, const gp_Pnt& O, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
return myEpsilon = Compute(S,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
Standard_Real GProp_VGProps::Perform(Face& S, Domain& D, const gp_Pnt& O, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
return myEpsilon = Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia,Eps);
}
void GProp_VGProps::Perform(const Face& S, const gp_Pnt& O){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
Compute(S,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void GProp_VGProps::Perform(Face& S, Domain& D, const gp_Pnt& O){
Standard_Real xloc, yloc, zloc;
loc.Coord(xloc, yloc, zloc);
Standard_Real Coeff[3];
O.Coord (Coeff[0], Coeff[1], Coeff[2]);
Coeff[0] -= xloc; Coeff[1] -= yloc; Coeff[2] -= zloc;
Compute(S,D,Standard_True,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real GProp_VGProps::Perform(Face& S, const gp_Pln& Pl, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
return myEpsilon = Compute(S,Standard_False,Coeff,loc,dim,g,inertia,Eps);
}
Standard_Real GProp_VGProps::Perform(Face& S, Domain& D, const gp_Pln& Pl, const Standard_Real Eps){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
return myEpsilon = Compute(S,D,Standard_False,Coeff,loc,dim,g,inertia,Eps);
}
void GProp_VGProps::Perform(const Face& S, const gp_Pln& Pl){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
Compute(S,Standard_False,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
void GProp_VGProps::Perform(Face& S, Domain& D, const gp_Pln& Pl){
Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc);
Standard_Real Coeff[4];
Pl.Coefficients (Coeff[0], Coeff[1],Coeff[2],Coeff[3]);
Coeff[3] = Coeff[3] - Coeff[0]*xloc - Coeff[1]*yloc - Coeff[2]*zloc;
Compute(S,D,Standard_False,Coeff,loc,dim,g,inertia);
myEpsilon = 1.0;
return;
}
Standard_Real GProp_VGProps::GetEpsilon(){
return myEpsilon;
}

View File

@@ -0,0 +1,472 @@
-- Created on: 2005-12-21
-- Created by: Sergey KHROMOV
-- Copyright (c) 2005-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class VGPropsGK from GProp (Arc as any;
Face as any;
Domain as any)
inherits GProps from GProp
---Purpose: Computes the global properties of a geometric solid
-- (3D closed region of space) delimited with :
-- - a point and a surface
-- - a plane and a surface
--
-- The surface can be :
-- - a surface limited with its parametric values U-V,
-- (naturally restricted)
-- - a surface limited in U-V space with its boundary
-- curves.
--
-- The surface's requirements to evaluate the global
-- properties are defined in the template FaceTool class from
-- the package GProp.
--
-- The adaptive 2D algorithm of Gauss-Kronrod integration of
-- double integral is used.
--
-- The inner integral is computed along U parameter of
-- surface. The integrand function is encapsulated in the
-- support class UFunction that is defined below.
--
-- The outer integral is computed along T parameter of a
-- bounding curve. The integrand function is encapsulated in
-- the support class TFunction that is defined below.
uses
Pnt from gp,
XYZ from gp,
Pln from gp,
Address from Standard,
Boolean from Standard,
Real from Standard
-- Template class functions. Used for integration. Begin
class UFunction from GProp inherits Function from math
---Purpose: This class represents the integrand function for
-- computation of an inner integral. The returned value
-- depends on the value type and the flag IsByPoint.
--
-- The type of returned value is the one of the following
-- values:
-- - GProp_Mass - volume computation.
-- - GProp_CenterMassX, GProp_CenterMassY,
-- GProp_CenterMassZ - X, Y and Z coordinates of center
-- of mass computation.
-- - GProp_InertiaXX, GProp_InertiaYY, GProp_InertiaZZ,
-- GProp_InertiaXY, GProp_InertiaXZ, GProp_InertiaYZ
-- - moments of inertia computation.
--
-- If the flag IsByPoint is set to Standard_True, the value is
-- returned for the region of space that is delimited by a
-- surface and a point. Otherwise all computations are
-- performed for the region of space delimited by a surface
-- and a plane.
uses
Pnt from gp,
XYZ from gp,
Address from Standard,
Boolean from Standard,
Real from Standard,
ValueType from GProp
is
Create(theSurface: Face;
theVertex : Pnt from gp;
IsByPoint : Boolean from Standard;
theCoeffs : Address from Standard)
---Purpose: Constructor. Initializes the function with the face, the
-- location point, the flag IsByPoint and the coefficients
-- theCoeff that have different meaning depending on the value
-- of IsByPoint.
-- If IsByPoint is equal to Standard_True, the number of the
-- coefficients is equal to 3 and they represent X, Y and Z
-- coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
-- correspondingly) of the shift, if the inertia is computed
-- with respect to the point different then the location.
-- If IsByPoint is equal to Standard_False, the number of the
-- coefficients is 4 and they represent the combination of
-- plane parameters and shift values.
returns UFunction from GProp;
SetValueType(me: in out; theType: ValueType from GProp);
---Purpose: Setting the type of the value to be returned.
---C++: inline
SetVParam(me: in out; theVParam: Real from Standard);
---Purpose: Setting the V parameter that is constant during the
-- integral computation.
---C++: inline
Value(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Returns a value of the function.
returns Boolean from Standard
is redefined;
-----------------------
-- Private methods --
-----------------------
VolumeValue(me: in out; X : Real from Standard;
thePMP0: out XYZ from gp;
theS : out Real from Standard;
theD1 : out Real from Standard)
---Purpose: Private method. Returns the value for volume computation.
-- Other returned values are:
-- - thePMP0 - PSurf(X,Y) minus Location.
-- - theS and theD1 coeffitients that are computed and used
-- for computation of center of mass and inertia values
-- by plane.
returns Real from Standard
is private;
CenterMassValue(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Private method. Returns a value for the center of mass
-- computation. If the value type other then GProp_CenterMassX,
-- GProp_CenterMassY or GProp_CenterMassZ this method returns
-- Standard_False. Returns Standard_True in case of successful
-- computation of a value.
returns Boolean from Standard
is private;
InertiaValue(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Private method. Computes the value of intertia. The type of
-- a value returned is defined by the value type. If it is
-- other then GProp_InertiaXX, GProp_InertiaYY,
-- GProp_InertiaZZ, GProp_InertiaXY, GProp_InertiaXZ or
-- GProp_InertiaYZ, the method returns Standard_False. Returns
-- Standard_True in case of successful computation of a value.
returns Boolean from Standard
is private;
fields
mySurface : Face;
myVertex : Pnt from gp;
myCoeffs : Address from Standard;
myVParam : Real from Standard;
myValueType: ValueType from GProp;
myIsByPoint: Boolean from Standard;
end UFunction;
-- Class TFunction.
class TFunction from GProp inherits Function from math
---Purpose: This class represents the integrand function for the outer
-- integral computation. The returned value represents the
-- integral of UFunction. It depends on the value type and the
-- flag IsByPoint.
uses
Pnt from gp,
Address from Standard,
Boolean from Standard,
Integer from Standard,
Real from Standard,
ValueType from GProp
is
Create(theSurface : Face;
theVertex : Pnt from gp;
IsByPoint : Boolean from Standard;
theCoeffs : Address from Standard;
theUMin : Real from Standard;
theTolerance: Real from Standard)
---Purpose: Constructor. Initializes the function with the face, the
-- location point, the flag IsByPoint, the coefficients
-- theCoeff that have different meaning depending on the value
-- of IsByPoint. The last two parameters are theUMin - the
-- lower bound of the inner integral. This value is fixed for
-- any integral. And the value of tolerance of inner integral
-- computation.
-- If IsByPoint is equal to Standard_True, the number of the
-- coefficients is equal to 3 and they represent X, Y and Z
-- coordinates (theCoeff[0], theCoeff[1] and theCoeff[2]
-- correspondingly) of the shift if the inertia is computed
-- with respect to the point different then the location.
-- If IsByPoint is equal to Standard_False, the number of the
-- coefficients is 4 and they represent the compbination of
-- plane parameters and shift values.
returns TFunction from GProp;
Init(me: in out);
SetNbKronrodPoints(me: in out; theNbPoints: Integer from Standard);
---Purpose: Setting the expected number of Kronrod points for the outer
-- integral computation. This number is required for
-- computation of a value of tolerance for inner integral
-- computation. After GetStateNumber method call, this number
-- is recomputed by the same law as in
-- math_KronrodSingleIntegration, i.e. next number of points
-- is equal to the current number plus a square root of the
-- current number. If the law in math_KronrodSingleIntegration
-- is changed, the modification algo should be modified
-- accordingly.
---C++: inline
SetValueType(me: in out; aType: ValueType from GProp);
---Purpose: Setting the type of the value to be returned. This
-- parameter is directly passed to the UFunction.
---C++: inline
SetTolerance(me: in out; aTol: Real from Standard);
---Purpose: Setting the tolerance for inner integration
---C++: inline
ErrorReached(me)
---Purpose: Returns the relative reached error of all values computation since
-- the last call of GetStateNumber method.
---C++: inline
returns Real from Standard;
AbsolutError(me)
---Purpose: Returns the absolut reached error of all values computation since
-- the last call of GetStateNumber method.
---C++: inline
returns Real from Standard;
Value(me: in out; X: Real from Standard;
F: out Real from Standard)
---Purpose: Returns a value of the function. The value represents an
-- integral of UFunction. It is computed with the predefined
-- tolerance using the adaptive Gauss-Kronrod method.
returns Boolean from Standard
is redefined;
GetStateNumber(me: in out)
---Purpose: Redefined method. Remembers the error reached during
-- computation of integral values since the object creation
-- or the last call of GetStateNumber. It is invoked in each
-- algorithm from the package math. Particularly in the
-- algorithm math_KronrodSingleIntegration that is used to
-- compute the integral of TFunction.
returns Integer
is redefined;
fields
mySurface : Face;
myUFunction : UFunction;
myUMin : Real from Standard;
myTolerance : Real from Standard;
myTolReached: Real from Standard;
myErrReached: Real from Standard;
myAbsError : Real from Standard;
myValueType : ValueType from GProp;
myIsByPoint : Boolean from Standard;
myNbPntOuter: Integer from Standard;
end TFunction;
-- Template class functions. Used for integration. End
is
Create
---Purpose: Empty constructor.
---C++: inline
returns VGPropsGK;
Create(theSurface : in out Face;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the naturally restricted surface
-- and the point VLocation.
returns VGPropsGK;
Create(theSurface : in out Face;
thePoint : Pnt from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the naturally restricted surface
-- and the point VLocation. The inertia is computed with
-- respect to thePoint.
returns VGPropsGK;
Create(theSurface : in out Face;
theDomain : in out Domain;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the surface bounded by the domain
-- and the point VLocation.
returns VGPropsGK;
Create(theSurface : in out Face;
theDomain : in out Domain;
thePoint : Pnt from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the surface bounded by the domain
-- and the point VLocation. The inertia is computed with
-- respect to thePoint.
returns VGPropsGK;
Create(theSurface : in out Face;
thePlane : Pln from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the naturally restricted surface
-- and the plane.
returns VGPropsGK;
Create(theSurface : in out Face;
theDomain : in out Domain;
thePlane : Pln from gp;
theLocation : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Constructor. Computes the global properties of a region of
-- 3D space delimited with the surface bounded by the domain
-- and the plane.
returns VGPropsGK;
SetLocation(me: in out; theLocation: Pnt from gp);
---Purpose: Sets the vertex that delimit 3D closed region of space.
---C++: inline
Perform(me: in out; theSurface : in out Face;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the naturally restricted surface and the
-- point VLocation.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face;
thePoint : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the naturally restricted surface and the
-- point VLocation. The inertia is computed with respect to
-- thePoint.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face;
theDomain : in out Domain;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the surface bounded by the domain and the
-- point VLocation.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face;
theDomain : in out Domain;
thePoint : Pnt from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the surface bounded by the domain and the
-- point VLocation. The inertia is computed with respect to
-- thePoint.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face;
thePlane : Pln from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the naturally restricted surface and the
-- plane.
returns Real from Standard;
Perform(me: in out; theSurface : in out Face;
theDomain : in out Domain;
thePlane : Pln from gp;
theTolerance: Real from Standard = 0.001;
theCGFlag: Boolean from Standard = Standard_False;
theIFlag: Boolean from Standard = Standard_False)
---Purpose: Computes the global properties of a region of 3D space
-- delimited with the surface bounded by the domain and the
-- plane.
returns Real from Standard;
GetErrorReached(me)
---Purpose: Returns the relative reached computation error.
---C++: inline
returns Real from Standard;
GetAbsolutError(me)
---Purpose: Returns the absolut reached computation error.
---C++: inline
returns Real from Standard;
-----------------------
-- Private methods --
-----------------------
PrivatePerform(me: in out;
theSurface : in out Face;
thePtrDomain: Address from Standard; -- pointer to Domain.
IsByPoint : Boolean from Standard;
theCoeffs : Address from Standard;
theTolerance: Real from Standard;
theCGFlag : Boolean from Standard;
theIFlag : Boolean from Standard)
---Purpose: Main method for computation of the global properties that
-- is invoked by each Perform method.
returns Real from Standard
is private;
fields
myErrorReached: Real from Standard;
myAbsolutError: Real from Standard;
end VGPropsGK;

View File

@@ -13,24 +13,22 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepGProp_VinertGK.ixx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_Array1OfBoolean.hxx>
#include <math_KronrodSingleIntegration.hxx>
#include <BRepGProp_TFunction.hxx>
#include <math_Vector.hxx>
#include <math.hxx>
//==========================================================================
//function : Constructor
//==========================================================================
BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag):
myErrorReached(0.)
GProp_VGPropsGK::GProp_VGPropsGK( Face &theSurface,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
: myErrorReached(0.)
{
SetLocation(theLocation);
Perform(theSurface, theTolerance, theCGFlag, theIFlag);
@@ -41,13 +39,14 @@ BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
//
//==========================================================================
BRepGProp_VinertGK::BRepGProp_VinertGK( BRepGProp_Face &theSurface,
const gp_Pnt &thePoint,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag):
myErrorReached(0.)
GProp_VGPropsGK::GProp_VGPropsGK( Face &theSurface,
const gp_Pnt &thePoint,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
: myErrorReached(0.)
{
SetLocation(theLocation);
Perform(theSurface, thePoint, theTolerance, theCGFlag, theIFlag);
@@ -58,13 +57,14 @@ BRepGProp_VinertGK::BRepGProp_VinertGK( BRepGProp_Face &theSurface
//
//==========================================================================
BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
BRepGProp_Domain &theDomain,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag):
myErrorReached(0.)
GProp_VGPropsGK::GProp_VGPropsGK( Face &theSurface,
Domain &theDomain,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
: myErrorReached(0.)
{
SetLocation(theLocation);
Perform(theSurface, theDomain, theTolerance, theCGFlag, theIFlag);
@@ -75,14 +75,15 @@ BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
//
//==========================================================================
BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
BRepGProp_Domain &theDomain,
const gp_Pnt &thePoint,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag):
myErrorReached(0.)
GProp_VGPropsGK::GProp_VGPropsGK( Face &theSurface,
Domain &theDomain,
const gp_Pnt &thePoint,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
: myErrorReached(0.)
{
SetLocation(theLocation);
Perform(theSurface, theDomain, thePoint, theTolerance, theCGFlag, theIFlag);
@@ -93,13 +94,14 @@ BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
//
//==========================================================================
BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
const gp_Pln &thePlane,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag):
myErrorReached(0.)
GProp_VGPropsGK::GProp_VGPropsGK( Face &theSurface,
const gp_Pln &thePlane,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
: myErrorReached(0.)
{
SetLocation(theLocation);
Perform(theSurface, thePlane, theTolerance, theCGFlag, theIFlag);
@@ -110,14 +112,15 @@ BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
//
//==========================================================================
BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
BRepGProp_Domain &theDomain,
const gp_Pln &thePlane,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag):
myErrorReached(0.)
GProp_VGPropsGK::GProp_VGPropsGK( Face &theSurface,
Domain &theDomain,
const gp_Pln &thePlane,
const gp_Pnt &theLocation,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
: myErrorReached(0.)
{
SetLocation(theLocation);
Perform(theSurface, theDomain, thePlane, theTolerance, theCGFlag, theIFlag);
@@ -128,16 +131,16 @@ BRepGProp_VinertGK::BRepGProp_VinertGK(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::Perform( Face &theSurface,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
Standard_Real aShift[] = { 0., 0., 0. };
return PrivatePerform(theSurface, NULL, Standard_True, &aShift, theTolerance,
theCGFlag, theIFlag);
theCGFlag, theIFlag);
}
//==========================================================================
@@ -145,11 +148,11 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
const gp_Pnt &thePoint,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::Perform( Face &theSurface,
const gp_Pnt &thePoint,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
gp_XYZ aXYZ(thePoint.XYZ().Subtracted(loc.XYZ()));
@@ -158,7 +161,7 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
aXYZ.Coord(aShift[0], aShift[1], aShift[2]);
return PrivatePerform(theSurface, NULL, Standard_True, &aShift, theTolerance,
theCGFlag, theIFlag);
theCGFlag, theIFlag);
}
//==========================================================================
@@ -166,18 +169,18 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
BRepGProp_Domain &theDomain,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::Perform( Face &theSurface,
Domain &theDomain,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
Standard_Real aShift[] = { 0., 0., 0. };
return PrivatePerform(theSurface, &theDomain,
Standard_True, &aShift, theTolerance,
theCGFlag, theIFlag);
Standard_True, &aShift, theTolerance,
theCGFlag, theIFlag);
}
//==========================================================================
@@ -185,12 +188,12 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
BRepGProp_Domain &theDomain,
const gp_Pnt &thePoint,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::Perform( Face &theSurface,
Domain &theDomain,
const gp_Pnt &thePoint,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
gp_XYZ aXYZ(thePoint.XYZ().Subtracted(loc.XYZ()));
@@ -199,8 +202,8 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
aXYZ.Coord(aShift[0], aShift[1], aShift[2]);
return PrivatePerform(theSurface, &theDomain,
Standard_True, &aShift, theTolerance,
theCGFlag, theIFlag);
Standard_True, &aShift, theTolerance,
theCGFlag, theIFlag);
}
//==========================================================================
@@ -208,11 +211,11 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
const gp_Pln &thePlane,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::Perform( Face &theSurface,
const gp_Pln &thePlane,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
Standard_Real aCoeff[4];
@@ -225,8 +228,8 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
aCoeff[3] = aCoeff[3] - aCoeff[0]*aXLoc - aCoeff[1]*aYLoc - aCoeff[2]*aZLoc;
return PrivatePerform(theSurface, NULL,
Standard_False, &aCoeff, theTolerance,
theCGFlag, theIFlag);
Standard_False, &aCoeff, theTolerance,
theCGFlag, theIFlag);
}
//==========================================================================
@@ -234,12 +237,12 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
BRepGProp_Domain &theDomain,
const gp_Pln &thePlane,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::Perform( Face &theSurface,
Domain &theDomain,
const gp_Pln &thePlane,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
Standard_Real aCoeff[4];
@@ -252,8 +255,8 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
aCoeff[3] = aCoeff[3] - aCoeff[0]*aXLoc - aCoeff[1]*aYLoc - aCoeff[2]*aZLoc;
return PrivatePerform(theSurface, &theDomain,
Standard_False, &aCoeff, theTolerance,
theCGFlag, theIFlag);
Standard_False, &aCoeff, theTolerance,
theCGFlag, theIFlag);
}
//==========================================================================
@@ -261,14 +264,14 @@ Standard_Real BRepGProp_VinertGK::Perform(BRepGProp_Face &theSurface,
// Compute the properties.
//==========================================================================
Standard_Real BRepGProp_VinertGK::PrivatePerform
(BRepGProp_Face &theSurface,
const Standard_Address thePtrDomain,
const Standard_Boolean IsByPoint,
const Standard_Address theCoeffs,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
Standard_Real GProp_VGPropsGK::PrivatePerform
( Face &theSurface,
const Standard_Address thePtrDomain,
const Standard_Boolean IsByPoint,
const Standard_Address theCoeffs,
const Standard_Real theTolerance,
const Standard_Boolean theCGFlag,
const Standard_Boolean theIFlag)
{
@@ -276,7 +279,7 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
Standard_Real *aCoeffs = (Standard_Real *)theCoeffs;
// Compute the number of 2d bounding curves of the face.
BRepGProp_Domain *aPDomain = NULL;
Domain *aPDomain = NULL;
Standard_Integer aNbCurves = 0;
// If the pointer to the domain is NULL, there is only one curve to treat:
@@ -284,7 +287,7 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
if (thePtrDomain == NULL)
aNbCurves = 1;
else {
aPDomain = (BRepGProp_Domain *)thePtrDomain;
aPDomain = (Domain *)thePtrDomain;
for (aPDomain->Init(); aPDomain->More(); aPDomain->Next())
aNbCurves++;
@@ -355,8 +358,8 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
// Get the spans on the curve.
Handle(TColStd_HArray1OfReal) aTKnots;
BRepGProp_TFunction aTFunc(theSurface, loc, IsByPoint, theCoeffs,
aUMin, aCrvTol);
GProp_TFunction aTFunc(theSurface, loc, IsByPoint, theCoeffs,
aUMin, aCrvTol);
theSurface.GetTKnots(aTMin, aTMax, aTKnots);
@@ -371,7 +374,7 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
// Empirical criterion.
aNbPnts = Min(15, theSurface.IntegrationOrder()/aNbTIntervals + 1);
aNbPnts = Max(5, aNbPnts);
// aNbPnts = theSurface.IntegrationOrder();
// aNbPnts = theSurface.IntegrationOrder();
aLocalValue.Init(0.);
aLocalTolReached.Init(0.);
@@ -401,28 +404,28 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
Standard_Real err1 = 0.;
while (i < iU) {
//cout << "-------------- Span " << i << " nbp: " << aNbPnts << endl;
Standard_Real aT1 = aTKnots->Value(i++);
Standard_Real aT2 = aTKnots->Value(i);
//cout << "-------------- Span " << i << " nbp: " << aNbPnts << endl;
Standard_Real aT1 = aTKnots->Value(i++);
Standard_Real aT2 = aTKnots->Value(i);
if(aT2 - aT1 < aTTol) continue;
if(aT2 - aT1 < aTTol) continue;
aTFunc.SetNbKronrodPoints(aNbPnts);
aTFunc.Init();
aTFunc.SetTolerance(aCrvTol/(aT2-aT1));
anIntegral.Perform(aTFunc, aT1, aT2, aNbPnts, aTolSpan, aNbMaxIter);
aTFunc.SetNbKronrodPoints(aNbPnts);
aTFunc.Init();
aTFunc.SetTolerance(aCrvTol/(aT2-aT1));
anIntegral.Perform(aTFunc, aT1, aT2, aNbPnts, aTolSpan, aNbMaxIter);
if (!anIntegral.IsDone()) {
myErrorReached = -1.;
if (!anIntegral.IsDone()) {
myErrorReached = -1.;
return myErrorReached;
}
return myErrorReached;
}
aLocalValue(k) += anIntegral.Value();
err1 = aTFunc.AbsolutError()*(aT2 - aT1);
//cout << "Errors: " << anIntegral.NbIterReached() << " " << anIntegral.AbsolutError() << " " << err1 << endl;
aLocalTolReached(k) += anIntegral.AbsolutError() + err1;
//cout << "--- Errors: " << anIntegral.NbIterReached() << " " << anIntegral.AbsolutError() << " " << err1 << endl;
aLocalValue(k) += anIntegral.Value();
err1 = aTFunc.AbsolutError()*(aT2 - aT1);
//cout << "Errors: " << anIntegral.NbIterReached() << " " << anIntegral.AbsolutError() << " " << err1 << endl;
aLocalTolReached(k) += anIntegral.AbsolutError() + err1;
//cout << "--- Errors: " << anIntegral.NbIterReached() << " " << anIntegral.AbsolutError() << " " << err1 << endl;
}
aValue(k) += aLocalValue(k);
@@ -451,13 +454,13 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
// Compute values of center of mass.
if(anAbsDim >= aVolTol) {
if (IsByPoint) {
aValue(2) = aCoeffs[0] + aValue(2)/dim;
aValue(3) = aCoeffs[1] + aValue(3)/dim;
aValue(4) = aCoeffs[2] + aValue(4)/dim;
aValue(2) = aCoeffs[0] + aValue(2)/dim;
aValue(3) = aCoeffs[1] + aValue(3)/dim;
aValue(4) = aCoeffs[2] + aValue(4)/dim;
} else {
aValue(2) /= dim;
aValue(3) /= dim;
aValue(4) /= dim;
aValue(2) /= dim;
aValue(3) /= dim;
aValue(4) /= dim;
}
} else {
aValue(2) = 0.;
@@ -471,10 +474,10 @@ Standard_Real BRepGProp_VinertGK::PrivatePerform
if(theIFlag) {
// Fill the matrix of inertia.
inertia.SetCols (gp_XYZ (aValue(5), aValue(8), aValue(9)),
gp_XYZ (aValue(8), aValue(6), aValue(10)),
gp_XYZ (aValue(9), aValue(10), aValue(7)));
gp_XYZ (aValue(8), aValue(6), aValue(10)),
gp_XYZ (aValue(9), aValue(10), aValue(7)));
}
//return myErrorReached;
return myAbsolutError;
}

View File

@@ -18,7 +18,7 @@
// Empty constructor.
//==========================================================================
inline BRepGProp_VinertGK::BRepGProp_VinertGK()
inline GProp_VGPropsGK::GProp_VGPropsGK()
: myErrorReached(0.),
myAbsolutError(0.)
{
@@ -29,7 +29,7 @@ inline BRepGProp_VinertGK::BRepGProp_VinertGK()
// Sets the vertex that delimit 3D closed region of space.
//==========================================================================
inline void BRepGProp_VinertGK::SetLocation(const gp_Pnt &theVertex)
inline void GProp_VGPropsGK::SetLocation(const gp_Pnt &theVertex)
{
loc = theVertex;
}
@@ -39,7 +39,7 @@ inline void BRepGProp_VinertGK::SetLocation(const gp_Pnt &theVertex)
// Returns the reached Error.
//==========================================================================
inline Standard_Real BRepGProp_VinertGK::GetErrorReached() const
inline Standard_Real GProp_VGPropsGK::GetErrorReached() const
{
return myErrorReached;
}

View File

@@ -52,6 +52,8 @@ is
class QualifiedCirc;
generic class QualifiedCurv;
enumeration Position is
unqualified, enclosing, enclosed, outside, noqualifier;
---Purpose:

View File

@@ -14,21 +14,20 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class QCurve from Geom2dGcc
generic class QualifiedCurv from GccEnt (TheCurve as any)
---Purpose: Creates a qualified 2d line.
uses Position from GccEnt,
Curve from Geom2dAdaptor
uses Position from GccEnt
is
Create(Curve : Curve from Geom2dAdaptor;
Create(Curve : TheCurve ;
Qualifier : Position from GccEnt )
returns QCurve from Geom2dGcc;
returns QualifiedCurv from GccEnt;
-- is private;
Qualified(me) returns Curve from Geom2dAdaptor
Qualified(me) returns TheCurve
is static;
Qualifier(me) returns Position from GccEnt
@@ -57,8 +56,15 @@ is static;
fields
TheQualifier : Position from GccEnt;
TheQualified : Curve from Geom2dAdaptor;
TheQualified : TheCurve;
end QCurve;
-- friends
-- Unqualified(Obj : Curv2d) from GccEnt,
-- Enclosing (Obj : Curv2d) from GccEnt,
-- Enclosed (Obj : Curv2d) from GccEnt,
-- Outside (Obj : Curv2d) from GccEnt
end QualifiedCurv;

Some files were not shown because too many files have changed in this diff Show More