1 ## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## Lesser General Public License for more details.
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
27 origin = GeomAPI_Pnt(10, 0, 0)
28 dir = GeomAPI_Dir(1, 0, 0)
34 assert(ax1.origin().distance(origin) < TOLERANCE)
35 assert(math.fabs(ax1.dir().dot(dir) - 1.) < TOLERANCE)
39 assert(ax1.origin().distance(origin) < TOLERANCE)
40 assert(math.fabs(ax1.dir().dot(dir) - 1.) < TOLERANCE)
47 assert(ax2.origin().distance(origin) < TOLERANCE)
48 assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE)
50 ax2 = GeomAPI_Ax2(origin, dir)
51 assert(ax2.origin().distance(origin) < TOLERANCE)
52 assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE)
54 dx = GeomAPI_Dir(0, 1, 0)
55 ax2 = GeomAPI_Ax2(origin, dir, dx)
56 assert(ax2.origin().distance(origin) < TOLERANCE)
57 assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE)
61 dy = GeomAPI_Dir(0, 0, 1)
67 assert(ax3.origin().distance(origin) < TOLERANCE)
68 assert(math.fabs(ax3.normal().dot(dy) - 1.) < TOLERANCE)
69 assert(math.fabs(ax3.dirX().dot(dir) - 1.) < TOLERANCE)
70 assert(math.fabs(ax3.dirY().dot(dx) - 1.) < TOLERANCE)
72 ax3 = GeomAPI_Ax3(origin, dx, dir)
73 assert(ax3.origin().distance(origin) < TOLERANCE)
74 assert(math.fabs(ax3.normal().dot(dir) - 1.) < TOLERANCE)
75 assert(math.fabs(ax3.dirX().dot(dx) - 1.) < TOLERANCE)
76 assert(math.fabs(ax3.dirY().dot(dy) - 1.) < TOLERANCE)
78 p2d = GeomAPI_Pnt2d(1, 2)
79 a2d = ax3.to2D(origin.x() + dx.x() * p2d.x() + dy.x() * p2d.y(),
80 origin.y() + dx.y() * p2d.x() + dy.y() * p2d.y(),
81 origin.z() + dx.z() * p2d.x() + dy.z() * p2d.y())
82 assert(a2d.distance(p2d) < TOLERANCE)