Blender V4.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
11namespace blender {
12
13template<typename T> struct Bounds {
14 T min;
15 T max;
16 Bounds() = default;
17 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};
66
67} // namespace blender
int pad[32 - sizeof(int)]
uint padding(uint offset, uint alignment)
void scale_from_center(const T &scale)
Bounds(const T &value)
Bounds(const T &min, const T &max)
void recenter(const T &new_center)
void resize(const T &new_size)
void translate(const T &offset)
T center() const
bool is_empty() const
Bounds()=default