Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_float3.hh
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | friend float3 operator*(const float3 &a, float b) | ||||
| return {a.x * b, a.y * b, a.z * b}; | return {a.x * b, a.y * b, a.z * b}; | ||||
| } | } | ||||
| friend float3 operator*(float a, const float3 &b) | friend float3 operator*(float a, const float3 &b) | ||||
| { | { | ||||
| return b * a; | return b * a; | ||||
| } | } | ||||
| friend float3 operator/(float3 a, const float3 &b) | |||||
| { | |||||
| return {a.x / b.x, a.y / b.y, a.z / b.z}; | |||||
JacquesLucke: This operation also isn't well defined, but I guess it's fine. There should be an assert that… | |||||
HooglyBooglyAuthorUnsubmitted Done Inline ActionsHmm, I can't assert here because it might actually be dividing by 0, oops... At this point I'm just going to remove the operations that require division from this patch. I don't know of a use case for them anyway. Eventually we might want to add a attribute_math::safe_divide<T> HooglyBoogly: Hmm, I can't assert here because it might actually be dividing by 0, oops... At this point I'm… | |||||
| } | |||||
| friend float3 operator/(const float3 &a, float b) | friend float3 operator/(const float3 &a, float b) | ||||
| { | { | ||||
| BLI_assert(b != 0.0f); | BLI_assert(b != 0.0f); | ||||
| return {a.x / b, a.y / b, a.z / b}; | return {a.x / b, a.y / b, a.z / b}; | ||||
| } | } | ||||
| friend std::ostream &operator<<(std::ostream &stream, const float3 &v) | friend std::ostream &operator<<(std::ostream &stream, const float3 &v) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines | |||||
This operation also isn't well defined, but I guess it's fine. There should be an assert that checks for division by zero.