Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_float3.hh')
-rw-r--r--source/blender/blenlib/BLI_float3.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh
index 04aae375889..8263ef72584 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -80,6 +80,11 @@ struct float3 {
return {-a.x, -a.y, -a.z};
}
+ friend float3 operator-(const float3 &a, const float &b)
+ {
+ return {a.x - b, a.y - b, a.z - b};
+ }
+
float3 &operator-=(const float3 &b)
{
this->x -= b.x;
@@ -218,6 +223,16 @@ struct float3 {
return result;
}
+ static float3 safe_divide(const float3 &a, const float b)
+ {
+ return (b != 0.0f) ? a / b : float3(0.0f);
+ }
+
+ static float3 floor(const float3 &a)
+ {
+ return float3(floorf(a.x), floorf(a.y), floorf(a.z));
+ }
+
void invert()
{
x = -x;