Blender V5.3
blender::blender::IndexRange Class Reference

#include <bmesh_polygon.hh>

Classes

class  Iterator

Public Member Functions

constexpr IndexRange ()=default
constexpr IndexRange (int64_t size)
constexpr IndexRange (const int64_t start, const int64_t size)
constexpr Iterator begin () const
constexpr Iterator end () const
constexpr int64_t operator[] (int64_t index) const
constexpr int64_t size () const
constexpr IndexRange index_range () const
constexpr bool is_empty () const
constexpr IndexRange with_new_end (const int64_t new_end) const
constexpr IndexRange after (int64_t n) const
constexpr IndexRange before (int64_t n) const
constexpr int64_t first () const
constexpr int64_t last (const int64_t n=0) const
constexpr int64_t one_before_start () const
constexpr int64_t one_after_last () const
constexpr int64_t start () const
constexpr bool contains (int64_t value) const
constexpr bool contains (const IndexRange range) const
constexpr IndexRange slice (int64_t start, int64_t size) const
constexpr IndexRange slice (IndexRange range) const
constexpr IndexRange intersect (IndexRange other) const
constexpr IndexRange drop_front (int64_t n) const
constexpr IndexRange drop_back (int64_t n) const
constexpr IndexRange take_front (int64_t n) const
constexpr IndexRange take_back (int64_t n) const
constexpr IndexRange shift (int64_t n) const

Static Public Member Functions

static constexpr IndexRange from_begin_size (const int64_t begin, const int64_t size)
static constexpr IndexRange from_begin_end (const int64_t begin, const int64_t end)
static constexpr IndexRange from_begin_end_inclusive (const int64_t begin, const int64_t last)
static constexpr IndexRange from_end_size (const int64_t end, const int64_t size)
static constexpr IndexRange from_single (const int64_t index)

Friends

constexpr friend bool operator== (IndexRange a, IndexRange b)
constexpr friend bool operator!= (IndexRange a, IndexRange b)
std::ostream & operator<< (std::ostream &stream, IndexRange range)

Detailed Description

Definition at line 54 of file bmesh_polygon.hh.

Constructor & Destructor Documentation

◆ IndexRange() [1/3]

blender::blender::IndexRange::IndexRange ( )
constexprdefault

◆ IndexRange() [2/3]

blender::blender::IndexRange::IndexRange ( int64_t size)
inlineexplicitconstexpr

Definition at line 62 of file bmesh_polygon.hh.

◆ IndexRange() [3/3]

blender::blender::IndexRange::IndexRange ( const int64_t start,
const int64_t size )
inlineconstexpr

Definition at line 67 of file bmesh_polygon.hh.

Member Function Documentation

◆ after()

IndexRange blender::blender::IndexRange::after ( int64_t n) const
inlineconstexpr

Create a new range starting at the end of the current one.

Definition at line 185 of file bmesh_polygon.hh.

Referenced by blender::ed::sculpt_paint::grease_pencil_apply_fill().

◆ before()

IndexRange blender::blender::IndexRange::before ( int64_t n) const
inlineconstexpr

Create a new range that ends at the start of the current one.

Definition at line 194 of file bmesh_polygon.hh.

◆ begin()

Iterator blender::blender::IndexRange::begin ( ) const
inlineconstexpr

◆ contains() [1/2]

bool blender::blender::IndexRange::contains ( const IndexRange range) const
inlineconstexpr

Returns true when all indices in the given range are also in the current range.

Definition at line 259 of file bmesh_polygon.hh.

◆ contains() [2/2]

bool blender::blender::IndexRange::contains ( int64_t value) const
inlineconstexpr

◆ drop_back()

IndexRange blender::blender::IndexRange::drop_back ( int64_t n) const
inlineconstexpr

Returns a new IndexRange with n elements removed from the end of the range. This invokes undefined behavior when n is negative.

Definition at line 317 of file bmesh_polygon.hh.

Referenced by blender::BLI_lasso_is_edge_inside().

◆ drop_front()

IndexRange blender::blender::IndexRange::drop_front ( int64_t n) const
inlineconstexpr

◆ end()

Iterator blender::blender::IndexRange::end ( ) const
inlineconstexpr

Definition at line 126 of file bmesh_polygon.hh.

◆ first()

int64_t blender::blender::IndexRange::first ( ) const
inlineconstexpr

Get the first element in the range. Asserts when the range is empty.

Definition at line 204 of file bmesh_polygon.hh.

References blender::ATTR_NONNULL(), blender::ATTR_WARN_UNUSED_RESULT, and blender::BM_face_point_inside_test().

◆ from_begin_end()

constexpr IndexRange blender::blender::IndexRange::from_begin_end ( const int64_t begin,
const int64_t end )
inlinestaticconstexpr

Definition at line 78 of file bmesh_polygon.hh.

◆ from_begin_end_inclusive()

constexpr IndexRange blender::blender::IndexRange::from_begin_end_inclusive ( const int64_t begin,
const int64_t last )
inlinestaticconstexpr

Definition at line 83 of file bmesh_polygon.hh.

◆ from_begin_size()

constexpr IndexRange blender::blender::IndexRange::from_begin_size ( const int64_t begin,
const int64_t size )
inlinestaticconstexpr

Definition at line 73 of file bmesh_polygon.hh.

◆ from_end_size()

constexpr IndexRange blender::blender::IndexRange::from_end_size ( const int64_t end,
const int64_t size )
inlinestaticconstexpr

◆ from_single()

constexpr IndexRange blender::blender::IndexRange::from_single ( const int64_t index)
inlinestaticconstexpr

Definition at line 93 of file bmesh_polygon.hh.

References blender::BM_face_calc_perimeter_with_mat3().

◆ index_range()

IndexRange blender::blender::IndexRange::index_range ( ) const
inlineconstexpr

Definition at line 161 of file bmesh_polygon.hh.

◆ intersect()

IndexRange blender::blender::IndexRange::intersect ( IndexRange other) const
inlineconstexpr

Returns a new IndexRange that contains the intersection of the current one with the given range. Returns empty range if there are no overlapping indices. The returned range is always a valid slice of this range.

Definition at line 294 of file bmesh_polygon.hh.

◆ is_empty()

bool blender::blender::IndexRange::is_empty ( ) const
inlineconstexpr

Returns true if the size is zero.

Definition at line 169 of file bmesh_polygon.hh.

◆ last()

int64_t blender::blender::IndexRange::last ( const int64_t n = 0) const
inlineconstexpr

Get the nth last element in the range. Asserts when the range is empty or when n is negative.

Definition at line 214 of file bmesh_polygon.hh.

Referenced by blender::gpu::Line::last(), and blender::MOD_lineart_gpencil_generate_v3().

◆ one_after_last()

int64_t blender::blender::IndexRange::one_after_last ( ) const
inlineconstexpr

Get the element one after the end. The returned value is undefined when the range is empty.

Definition at line 235 of file bmesh_polygon.hh.

Referenced by blender::split_index_range_by_alignment().

◆ one_before_start()

int64_t blender::blender::IndexRange::one_before_start ( ) const
inlineconstexpr

Get the element one before the beginning. The returned value is undefined when the range is empty, and the range must start after zero already.

Definition at line 226 of file bmesh_polygon.hh.

◆ operator[]()

int64_t blender::blender::IndexRange::operator[] ( int64_t index) const
inlineconstexpr

Access an element in the range.

Definition at line 134 of file bmesh_polygon.hh.

References blender::ATTR_NONNULL().

◆ shift()

IndexRange blender::blender::IndexRange::shift ( int64_t n) const
inlineconstexpr

Move the range forward or backward within the larger array. The amount may be negative, but its absolute value cannot be greater than the existing start of the range.

Definition at line 350 of file bmesh_polygon.hh.

◆ size()

int64_t blender::blender::IndexRange::size ( ) const
inlineconstexpr

Get the amount of numbers in the range.

Definition at line 156 of file bmesh_polygon.hh.

Referenced by blender::gpu::Line::last(), blender::MOD_solidify_nonmanifold_modifyMesh(), and blender::gpu::PruningStream::parse_token_range().

◆ slice() [1/2]

IndexRange blender::blender::IndexRange::slice ( IndexRange range) const
inlineconstexpr

Definition at line 284 of file bmesh_polygon.hh.

◆ slice() [2/2]

IndexRange blender::blender::IndexRange::slice ( int64_t start,
int64_t size ) const
inlineconstexpr

Returns a new range, that contains a sub-interval of the current one.

Definition at line 276 of file bmesh_polygon.hh.

◆ start()

int64_t blender::blender::IndexRange::start ( ) const
inlineconstexpr

Get the first element in the range. The returned value is undefined when the range is empty.

Definition at line 243 of file bmesh_polygon.hh.

Referenced by blender::DRW_select_buffer_context_offset_for_object_elem(), blender::DRW_select_buffer_elem_get(), and blender::MOD_solidify_nonmanifold_modifyMesh().

◆ take_back()

IndexRange blender::blender::IndexRange::take_back ( int64_t n) const
inlineconstexpr

Returns a new IndexRange that only contains the last n elements. This invokes undefined behavior when n is negative.

Definition at line 339 of file bmesh_polygon.hh.

◆ take_front()

IndexRange blender::blender::IndexRange::take_front ( int64_t n) const
inlineconstexpr

Returns a new IndexRange that only contains the first n elements. This invokes undefined behavior when n is negative.

Definition at line 328 of file bmesh_polygon.hh.

Referenced by blender::bm_to_mesh_edges(), blender::bm_to_mesh_faces(), blender::bm_to_mesh_loops(), and blender::bm_to_mesh_verts().

◆ with_new_end()

IndexRange blender::blender::IndexRange::with_new_end ( const int64_t new_end) const
inlineconstexpr

Creates a new index range with the same beginning but a different end.

Definition at line 177 of file bmesh_polygon.hh.

◆ operator!=

friend bool operator!= ( IndexRange a,
IndexRange b )
friend

Definition at line 148 of file bmesh_polygon.hh.

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
IndexRange range )
friend

◆ operator==

friend bool operator== ( IndexRange a,
IndexRange b )
friend

Two ranges compare equal when they contain the same numbers.

Definition at line 144 of file bmesh_polygon.hh.


The documentation for this class was generated from the following file: