01_user_documentation:07_rgg_xl:02_xl:10_rgg_addition:04_operator_overload:tuple
This is an old revision of the document!
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).
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.1774628154.txt.gz ยท Last modified: 2026/03/27 17:15 by Tim
