Blender V5.3
BLI_bounds_types.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11namespace blender {
12
13template<typename T> struct Bounds {
16 Bounds() = default;
17 explicit Bounds(const T &value) : min(value), max(value) {}
18 Bounds(const T &min, const T &max) : min(min), max(max) {}
19
24 bool is_empty() const;
29 T center() const;
35 T size() const;
36
41 void translate(const T &offset);
46 void scale_from_center(const T &scale);
47
53 void resize(const T &new_size);
58 void recenter(const T &new_center);
59
64 template<typename PaddingT> void pad(const PaddingT &padding);
65
70 bool contains(const T &point) const;
71
75 bool intersects(const Bounds<T> &other) const;
79 bool intersects_segment(const T &start, const T &end) const;
80};
81
82} // namespace blender
int pad[32 - sizeof(int)]
float3x3 scale(float3x3 mat, float2 scale)
float4x4 translate(float4x4 mat, float3 translation)
#define T
BMesh Iterators.
uint padding(uint offset, uint alignment)
void scale_from_center(const T &scale)
bool contains(const T &point) const
Bounds(const T &value)
Bounds(const T &min, const T &max)
void recenter(const T &new_center)
void resize(const T &new_size)
bool intersects_segment(const T &start, const T &end) const
T center() const
bool is_empty() const
Bounds()=default
bool intersects(const Bounds< T > &other) const