2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2013-12-23 16:03:07 +11:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bmesh
|
2013-12-23 16:03:07 +11:00
|
|
|
*
|
|
|
|
|
* BMesh inline operator functions.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2015-05-01 19:16:58 +10:00
|
|
|
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2)
|
2014-06-27 20:03:50 +10:00
|
|
|
BLI_INLINE BMDiskLink *bmesh_disk_edge_link_from_vert(const BMEdge *e, const BMVert *v)
|
|
|
|
|
{
|
|
|
|
|
BLI_assert(BM_vert_in_edge(e, v));
|
|
|
|
|
return (BMDiskLink *)&(&e->v1_disk_link)[v == e->v2];
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-23 16:03:07 +11:00
|
|
|
/**
|
|
|
|
|
* \brief Next Disk Edge
|
|
|
|
|
*
|
|
|
|
|
* Find the next edge in a disk cycle
|
|
|
|
|
*
|
|
|
|
|
* \return Pointer to the next edge in the disk cycle for the vertex v.
|
|
|
|
|
*/
|
2015-05-01 19:16:58 +10:00
|
|
|
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
|
2014-06-27 20:03:50 +10:00
|
|
|
BLI_INLINE BMEdge *bmesh_disk_edge_next_safe(const BMEdge *e, const BMVert *v)
|
2013-12-23 16:03:07 +11:00
|
|
|
{
|
2019-03-27 17:14:36 +11:00
|
|
|
if (v == e->v1) {
|
2013-12-23 16:03:07 +11:00
|
|
|
return e->v1_disk_link.next;
|
2019-03-27 17:14:36 +11:00
|
|
|
}
|
|
|
|
|
if (v == e->v2) {
|
2013-12-23 16:03:07 +11:00
|
|
|
return e->v2_disk_link.next;
|
2019-03-27 17:14:36 +11:00
|
|
|
}
|
2013-12-23 16:03:07 +11:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-01 19:16:58 +10:00
|
|
|
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
|
2014-06-27 20:03:50 +10:00
|
|
|
BLI_INLINE BMEdge *bmesh_disk_edge_prev_safe(const BMEdge *e, const BMVert *v)
|
2013-12-23 16:03:07 +11:00
|
|
|
{
|
2019-03-27 17:14:36 +11:00
|
|
|
if (v == e->v1) {
|
2013-12-23 16:03:07 +11:00
|
|
|
return e->v1_disk_link.prev;
|
2019-03-27 17:14:36 +11:00
|
|
|
}
|
|
|
|
|
if (v == e->v2) {
|
2013-12-23 16:03:07 +11:00
|
|
|
return e->v2_disk_link.prev;
|
2019-03-27 17:14:36 +11:00
|
|
|
}
|
2013-12-23 16:03:07 +11:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-27 20:03:50 +10:00
|
|
|
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMEdge *bmesh_disk_edge_next(const BMEdge *e,
|
|
|
|
|
const BMVert *v)
|
|
|
|
|
{
|
|
|
|
|
return BM_DISK_EDGE_NEXT(e, v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2) BLI_INLINE BMEdge *bmesh_disk_edge_prev(const BMEdge *e,
|
|
|
|
|
const BMVert *v)
|
|
|
|
|
{
|
|
|
|
|
return BM_DISK_EDGE_PREV(e, v);
|
|
|
|
|
}
|