| Technical Information II. |
 |
| Sandor_ Racz | 2002/06/01 03:44 |
Open CASCADE C++ operators that have Python equivalents are supported.
E.g. it is possible to add two gp_XYZ objects or a gp_XYZ can be multiplied / divided by a scalar number. Other operators (those ones that do not have Python equivalents might be supported in subsequent versions as Python functions if it will be necessary.)
Examples:
>>> from gp_XYZ import *
>>> p = gp_XYZ(1,2,3)
>>> p.X()
1.0
>>> q = gp_XYZ(4,5,6)
>>> q.X(),q.Y(),q.Z()
(4.0, 5.0, 6.0)
>>> r=p+q
>>> r.X(),r.Y(),r.Z()
(5.0, 7.0, 9.0)
>>> s = r*13
>>> s.X(),s.Y(),s.Z()
(65.0, 91.0, 117.0)
>>> from gp_Dir import *
>>> dir1 = gp_Dir(1,2,3)
>>> sum=dir1.X()*dir1.X()+dir1.Y()*dir1.Y()+dir1.Z()*dir1.Z()
>>> sum
1.0
>>> dir2=gp_Dir(4,5,6)
>>> prod=dir1*dir2
>>> prod
0.97463184619707621
>>> dir3=-dir1
>>> dir3.X(),dir3.Y(),dir3.Z()
(-0.2672612419124244, -0.53452248382484879, -0.80178372573727319)
>>> |  |
|
| | |