01_user_documentation:07_rgg_xl:02_xl:10_rgg_addition:04_operator_overload:tuple
Table of Contents
Tuples
Tuples are set of 2 to 4 values of either float or double. They are implemented by the classes: PointXY, VectorXY, where X is the dimension (2 to 4) and Y is the type (d, or f):
- Vector2f
- Vector2d
- Point2f
- Point2d
- Vector3f
- Vector3d
- Point3d
- Point3f
- Vector4d
- Vector4f
- Point4d
- Point4f
Math operator
Tuple + TupleTuple += TupleTuple * NumberNumber * TupleTuple *= Number- TupleTuple / NumberTuple - TupleTuple -= Tuple
This operators work for tuples of the same dimension. E.g. Point2f and Vector2f or Point2d and Point2f.
Vector3f a = new Vector3f(0,1,2); Vector3f b = new Vector3f(0,2,3); println(a + b); //(0.0, 3.0, 5.0) println(a + a + b); //(0.0, 4.0, 7.0) println(a - b); //(0.0, -1.0, -1.0) println(a - a - b); //(0.0, -2.0, -3.0) println(a * 3); //(0.0, 3.0, 6.0) println(a /2); //(0.0, 0.5, 1.0) println(a /1.3); //(0.0, 0.7692308, 1.5384616)
01_user_documentation/07_rgg_xl/02_xl/10_rgg_addition/04_operator_overload/tuple.txt ยท Last modified: 2026/03/27 17:16 by Tim
