Operators on Point and Extent
The Point and Extent classes support many mathematical operators, but the set of available operators (and their expected behavior) isn’t quite as obvious as one might think.
The table below lists all supported operators, with notes below on special cases.
For the rationale behind these operations, see RFC-41.
LHS |
RHS |
Operator |
Result |
Notes |
PointD |
PointD |
+ , += |
Not supported |
|
PointD |
PointD |
- |
ExtentD |
|
PointD |
PointD |
-= |
Not supported |
|
PointD |
PointI |
- |
ExtentD |
|
PointD |
PointI |
-= |
Not supported |
|
PointD |
ExtentD |
+, +=, -, -= |
PointD |
|
PointD |
ExtentI |
+ , += , - , -= |
PointD |
|
PointI |
PointD |
+ , += |
Not supported |
|
PointI |
PointI |
+ , += |
Not supported |
|
PointI |
ExtentD |
+ |
PointD |
|
PointI |
ExtentD |
+= |
Not supported |
|
PointI |
ExtentI |
+ , += |
PointI |
|
PointI |
PointD |
- |
ExtentD |
|
PointI |
PointD |
-= |
Not supported |
|
PointI |
PointI |
- |
ExtentI |
|
PointI |
PointI |
-= |
Not supported |
|
PointI |
ExtentD |
- |
PointD |
|
PointI |
ExtentD |
-= |
Not supported |
|
PointI |
ExtentI |
- , -= |
PointI |
|
ExtentD |
PointD |
+ |
PointD |
|
ExtentD |
PointD |
+= |
Not supported |
|
ExtentD |
PointD |
- , -= |
Not supported |
|
ExtentD |
PointI |
+ |
PointD |
|
ExtentD |
PointI |
+= |
Not supported |
|
ExtentD |
PointI |
- , -= |
Not supported |
|
ExtentD |
ExtentD |
+ , += , - , -= |
ExtentD |
|
ExtentD |
ExtentI |
+ , += , - , -= |
ExtentD |
|
ExtentI |
PointD |
+ |
PointD |
|
ExtentI |
PointD |
+= |
Not supported |
|
ExtentI |
PointD |
- , -= |
Not supported |
|
ExtentI |
PointI |
+ |
PointI |
|
ExtentI |
PointI |
+= |
Not supported |
|
ExtentI |
PointI |
- , -= |
Not supported |
|
ExtentI |
ExtentD |
+ , - |
ExtentD |
|
ExtentI |
ExtentD |
+= , -= |
Not supported |
|
ExtentI |
ExtentI |
+ , - , += , -= |
ExtentI |
|
ExtentD |
double |
* , *= , / , /= |
ExtentD |
|
ExtentD |
double |
// , //= |
Not supported |
|
ExtentD |
int |
* , *= , / , /= |
ExtentD |
|
ExtentD |
int |
// , //= |
Not supported |
|
ExtentI |
double |
* |
ExtentD |
|
ExtentI |
double |
*= |
Not supported |
|
ExtentI |
double |
/ |
ExtentD |
|
ExtentI |
double |
/= |
Not supported |
|
ExtentI |
double |
// , //= |
Not supported |
|
ExtentI |
int |
* , *= |
ExtentI |
|
ExtentI |
int |
/ |
ExtentD |
|
ExtentI |
int |
/= |
Not supported (Python), ExtentI (C++) |
|
ExtentI |
int |
// , //= |
ExtentI |
|
double |
ExtentD |
* |
ExtentD |
|
double |
ExtentI |
* |
ExtentD |
|
int |
ExtentD |
* |
ExtentD |
|
int |
ExtentI |
* |
ExtentI |
|