Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_boundbox.h
| Show First 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | BoundBox2D make_relative_to(const BoundBox2D &other) const | ||||
| result.left = ((left - other.left) / (other.right - other.left)); | result.left = ((left - other.left) / (other.right - other.left)); | ||||
| result.right = ((right - other.left) / (other.right - other.left)); | result.right = ((right - other.left) / (other.right - other.left)); | ||||
| result.bottom = ((bottom - other.bottom) / (other.top - other.bottom)); | result.bottom = ((bottom - other.bottom) / (other.top - other.bottom)); | ||||
| result.top = ((top - other.bottom) / (other.top - other.bottom)); | result.top = ((top - other.bottom) / (other.top - other.bottom)); | ||||
| return result; | return result; | ||||
| } | } | ||||
| BoundBox2D clamp(float mn = 0.0f, float mx = 1.0f) | BoundBox2D clamp(float mn = 0.0f, float mx = 1.0f) const | ||||
| { | { | ||||
| BoundBox2D result; | BoundBox2D result; | ||||
| result.left = ccl::clamp(left, mn, mx); | result.left = ccl::clamp(left, mn, mx); | ||||
| result.right = ccl::clamp(right, mn, mx); | result.right = ccl::clamp(right, mn, mx); | ||||
| result.bottom = ccl::clamp(bottom, mn, mx); | result.bottom = ccl::clamp(bottom, mn, mx); | ||||
| result.top = ccl::clamp(top, mn, mx); | result.top = ccl::clamp(top, mn, mx); | ||||
| return result; | return result; | ||||
| } | } | ||||
| }; | }; | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
| #endif /* __UTIL_BOUNDBOX_H__ */ | #endif /* __UTIL_BOUNDBOX_H__ */ | ||||