1 # Copyright (C) 2018-2019 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 email : webmaster.salome@opencascade.com
26 origin = GeomAPI_Pnt(10, 0, 0)
27 dir = GeomAPI_Dir(1, 0, 0)
33 assert(ax1.origin().distance(origin) < TOLERANCE)
34 assert(math.fabs(ax1.dir().dot(dir) - 1.) < TOLERANCE)
38 assert(ax1.origin().distance(origin) < TOLERANCE)
39 assert(math.fabs(ax1.dir().dot(dir) - 1.) < TOLERANCE)
46 assert(ax2.origin().distance(origin) < TOLERANCE)
47 assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE)
49 ax2 = GeomAPI_Ax2(origin, dir)
50 assert(ax2.origin().distance(origin) < TOLERANCE)
51 assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE)
53 dx = GeomAPI_Dir(0, 1, 0)
54 ax2 = GeomAPI_Ax2(origin, dir, dx)
55 assert(ax2.origin().distance(origin) < TOLERANCE)
56 assert(math.fabs(ax2.dir().dot(dir) - 1.) < TOLERANCE)
60 dy = GeomAPI_Dir(0, 0, 1)
66 assert(ax3.origin().distance(origin) < TOLERANCE)
67 assert(math.fabs(ax3.normal().dot(dy) - 1.) < TOLERANCE)
68 assert(math.fabs(ax3.dirX().dot(dir) - 1.) < TOLERANCE)
69 assert(math.fabs(ax3.dirY().dot(dx) - 1.) < TOLERANCE)
71 ax3 = GeomAPI_Ax3(origin, dx, dir)
72 assert(ax3.origin().distance(origin) < TOLERANCE)
73 assert(math.fabs(ax3.normal().dot(dir) - 1.) < TOLERANCE)
74 assert(math.fabs(ax3.dirX().dot(dx) - 1.) < TOLERANCE)
75 assert(math.fabs(ax3.dirY().dot(dy) - 1.) < TOLERANCE)
77 p2d = GeomAPI_Pnt2d(1, 2)
78 a2d = ax3.to2D(origin.x() + dx.x() * p2d.x() + dy.x() * p2d.y(),
79 origin.y() + dx.y() * p2d.x() + dy.y() * p2d.y(),
80 origin.z() + dx.z() * p2d.x() + dy.z() * p2d.y())
81 assert(a2d.distance(p2d) < TOLERANCE)