0024005: Intersecting a slightly off angle plane with a cylinder takes 7+ seconds
[occt.git] / src / Visual3d / Visual3d_ClipPlane.cxx
CommitLineData
b311480e 1// Created by: NW,JPB,CAL
2// Copyright (c) 1991-1999 Matra Datavision
3// Copyright (c) 1999-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20
7fd59977 21
7fd59977 22
23//-Version
24
25//-Design Declaration des variables specifiques aux plans de
26// clipping modele
27
28//-Warning Un plan de clipping est defini par son equation ou
29// par un point et sa normale
30// Equation : A*X + B*Y + C*Z + D = 0
31
32//-References
33
34//-Language C++ 2.0
35
36//-Declarations
37
38// for the class
39#include <Visual3d_ClipPlane.ixx>
40
41#include <Graphic3d_GraphicDriver.hxx>
42
43//-Aliases
44
45//-Global data definitions
46
47//-Constructors
48
49//-Destructors
50
51//-Methods, in order
52
53Visual3d_ClipPlane::Visual3d_ClipPlane (const Standard_Real ACoefA, const Standard_Real ACoefB, const Standard_Real ACoefC, const Standard_Real ACoefD) {
54
55 MyCPlane.WsId = -1;
56 MyCPlane.ViewId = 0; /* not used */
57
58 MyCPlane.CoefA = float (ACoefA);
59 MyCPlane.CoefB = float (ACoefB);
60 MyCPlane.CoefC = float (ACoefC);
61 MyCPlane.CoefD = float (ACoefD);
62
63 MyCPlane.PlaneId =
64 Graphic3d_GraphicDriver::Plane (MyCPlane, Standard_False);
65
66}
67
68void Visual3d_ClipPlane::SetPlane (const Standard_Real ACoefA, const Standard_Real ACoefB, const Standard_Real ACoefC, const Standard_Real ACoefD) {
69
70 MyCPlane.CoefA = float (ACoefA);
71 MyCPlane.CoefB = float (ACoefB);
72 MyCPlane.CoefC = float (ACoefC);
73 MyCPlane.CoefD = float (ACoefD);
74
75 MyCPlane.PlaneId =
76 Graphic3d_GraphicDriver::Plane (MyCPlane, Standard_True);
77
78}
79
80void Visual3d_ClipPlane::Plane (Standard_Real& ACoefA, Standard_Real& ACoefB, Standard_Real& ACoefC, Standard_Real& ACoefD) const {
81
82 ACoefA = Standard_Real (MyCPlane.CoefA);
83 ACoefB = Standard_Real (MyCPlane.CoefB);
84 ACoefC = Standard_Real (MyCPlane.CoefC);
85 ACoefD = Standard_Real (MyCPlane.CoefD);
86
87}
88
89Standard_Integer Visual3d_ClipPlane::Limit () {
90
91#ifdef GER61454
92 return 4; // Obsolete method, calls instead myView->PlaneLimit()
93#else
94 // Old method, replaced by GraphicDriver::InquirePlaneLimit ()
95 return 0;
96#endif
97}
98
99Standard_Integer Visual3d_ClipPlane::Identification () const {
100
101 return (Standard_Integer (MyCPlane.PlaneId));
102
103}