1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023625: New functionality building reflect lines on a shape

Adding test case for this fix; Small corrections
This commit is contained in:
jgv
2013-07-12 12:24:21 +04:00
parent 97acf541ac
commit bda8360543
25 changed files with 715 additions and 41 deletions

34
src/HLRAppli/HLRAppli.cdl Normal file
View File

@@ -0,0 +1,34 @@
-- File: HLRAppli.cdl
-- Created: 05.12.12 15:50:05
-- Created by: Julia GERASIMOVA
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
package HLRAppli
---Purpose : This package represents applications
-- of Hidden Lines Removal algorithm
uses
TopoDS,
HLRAlgo
is
class ReflectLines;
end HLRAppli;

View File

@@ -0,0 +1,60 @@
-- File: HLRAppli_ReflectLines.cdl
-- Created: 05.12.12 15:53:35
-- Created by: Julia GERASIMOVA
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class ReflectLines from HLRAppli
---Purpose : This class builds reflect lines on a shape
-- according to the axes of view defined by user.
-- Reflect lines are represented by edges in 3d.
uses
Shape from TopoDS,
Projector from HLRAlgo
is
Create(aShape : Shape from TopoDS)
---Purpose: Constructor
--
returns ReflectLines from HLRAppli;
SetAxes(me: in out;
Nx, Ny, Nz : Real from Standard;
XAt, YAt, ZAt : Real from Standard;
XUp, YUp, ZUp : Real from Standard);
---Purpose: Sets the normal to the plane of visualisation,
-- the coordinates of the view point and
-- the coordinates of the vertical direction vector.
Perform(me: in out);
GetResult(me)
returns Shape from TopoDS;
---Purpose: returns resulting compound of reflect lines
-- represented by edges in 3d
fields
myProjector : Projector from HLRAlgo;
myShape : Shape from TopoDS;
myCompound : Shape from TopoDS;
end ReflectLines;

View File

@@ -0,0 +1,93 @@
// File: HLRAppli_ReflectLines.cxx
// Created: 05.12.12 12:55:50
// Created by: Julia GERASIMOVA
// Copyright (c) 2001-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <HLRAppli_ReflectLines.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <BRep_Builder.hxx>
#include <gp_Ax3.hxx>
//=======================================================================
//function : HLRAppli_ReflectLines
//purpose : Constructor
//=======================================================================
HLRAppli_ReflectLines::HLRAppli_ReflectLines(const TopoDS_Shape& aShape)
{
myShape = aShape;
}
//=======================================================================
//function : SetAxes
//purpose :
//=======================================================================
void HLRAppli_ReflectLines::SetAxes(const Standard_Real Nx,
const Standard_Real Ny,
const Standard_Real Nz,
const Standard_Real XAt,
const Standard_Real YAt,
const Standard_Real ZAt,
const Standard_Real XUp,
const Standard_Real YUp,
const Standard_Real ZUp)
{
Standard_Boolean IsPerspective = Standard_False;
Standard_Real aFocus = 1;
//Prs3d_Projector aPrs3dProjector(IsPerspective, aFocus, Nx, Ny, Nz, XAt, YAt, ZAt, XUp, YUp, ZUp);
gp_Pnt At (XAt,YAt,ZAt);
gp_Dir Zpers (Nx,Ny,Nz);
gp_Dir Ypers (XUp,YUp,ZUp);
gp_Dir Xpers = Ypers.Crossed(Zpers);
gp_Ax3 Axe (At, Zpers, Xpers);
gp_Trsf T;
T.SetTransformation(Axe);
//myProjector = aPrs3dProjector.Projector();
myProjector = HLRAlgo_Projector(T,IsPerspective,aFocus);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void HLRAppli_ReflectLines::Perform()
{
Handle(HLRBRep_Algo) aHLRAlgo = new HLRBRep_Algo();
aHLRAlgo->Add( myShape, 0 );
aHLRAlgo->Projector( myProjector );
aHLRAlgo->Update();
aHLRAlgo->Hide();
HLRBRep_HLRToShape aHLRToShape( aHLRAlgo );
myCompound = aHLRToShape.OutLineVCompound3d();
}
//=======================================================================
//function : GetResult
//purpose :
//=======================================================================
TopoDS_Shape HLRAppli_ReflectLines::GetResult() const
{
return myCompound;
}