Vec2D Functions¶
API functions that utilize the vec2d class are grouped here. For details of the class, including member functions, see vec2d. vec2d is used for the two dimensional problems that come up inside three dimensional ones – parameter space coordinates, projections into a plane, and polygon tests.
vec2d¶
|
|
|
|
|
|
|
|
|
|
|
|
|
- class openvsp.vec2d(*args)[source]¶
Proxy of C++ vec2d class.
- property thisown¶
The membership flag
- property v¶
v : a(2).double
Operators¶
- vec2d.__getitem__(other)[source]¶
Index a vec2d by coordinate, 0 for X and 1 for Y. An index outside that range raises an IndexError, which is also what lets list() and tuple() walk a vec2d.
a = vec2d( 3.0, 4.0 ) assert abs( a[0] - 3.0 ) < 1e-12, "vec2d index 0 is not x" assert list( a ) == [ 3.0, 4.0 ], "vec2d did not iterate as x, y" a[1] = 5.0 assert abs( a.y() - 5.0 ) < 1e-12, "vec2d index assignment did not take"
- vec2d.__add__(other)[source]¶
Addition operator for two vec2d objects, performed by the addition of each corresponding component
a = vec2d( 1.0, 2.0 ) b = vec2d( 3.0, 4.0 ) c = a + b assert abs( c.x() - 4.0 ) < 1e-12, "vec2d addition is wrong in x" assert abs( c.y() - 6.0 ) < 1e-12, "vec2d addition is wrong in y"
- vec2d.__sub__(other)[source]¶
Subtraction operator for two vec2d objects, performed by the subtraction of each corresponding component
a = vec2d( 3.0, 4.0 ) b = vec2d( 1.0, 2.0 ) c = a - b assert abs( c.x() - 2.0 ) < 1e-12, "vec2d subtraction is wrong in x" assert abs( c.y() - 2.0 ) < 1e-12, "vec2d subtraction is wrong in y"
- vec2d.__mul__(other)[source]¶
Scalar multiplication operator for a vec2d, performed by the multiplication of each vec2d component and the scalar
a = vec2d( 1.0, 2.0 ) c = a * 1.5 assert abs( c.x() - 1.5 ) < 1e-12, "vec2d scaling is wrong in x" assert abs( c.y() - 3.0 ) < 1e-12, "vec2d scaling is wrong in y"
- vec2d.__truediv__(other)[source]¶
Scalar division operator for a vec2d, performed by the division of each vec2d component by the scalar
a = vec2d( 3.0, 6.0 ) c = a / 1.5 assert abs( c.x() - 2.0 ) < 1e-12, "vec2d division is wrong in x" assert abs( c.y() - 4.0 ) < 1e-12, "vec2d division is wrong in y"
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- openvsp.dist_squared(vec3d a, vec3d b) double[source]¶
- openvsp.dist_squared(vec2d a, vec2d b) double