Blender
V3.3
|
Classes | |
class | MeshAttributeInterpolator |
Enumerations | |
enum class | eAttributeMapMode { INTERPOLATED , NEAREST } |
Functions | |
void | sample_point_attribute (const Mesh &mesh, Span< int > looptri_indices, Span< float3 > bary_coords, const GVArray &data_in, const IndexMask mask, GMutableSpan data_out) |
void | sample_corner_attribute (const Mesh &mesh, Span< int > looptri_indices, Span< float3 > bary_coords, const GVArray &data_in, const IndexMask mask, GMutableSpan data_out) |
void | sample_face_attribute (const Mesh &mesh, Span< int > looptri_indices, const GVArray &data_in, const IndexMask mask, GMutableSpan data_out) |
int | sample_surface_points_spherical (RandomNumberGenerator &rng, const Mesh &mesh, Span< int > looptri_indices_to_sample, const float3 &sample_pos, float sample_radius, float approximate_density, Vector< float3 > &r_bary_coords, Vector< int > &r_looptri_indices, Vector< float3 > &r_positions) |
int | sample_surface_points_projected (RandomNumberGenerator &rng, const Mesh &mesh, BVHTreeFromMesh &mesh_bvhtree, const float2 &sample_pos_re, float sample_radius_re, FunctionRef< void(const float2 &pos_re, float3 &r_start, float3 &r_end)> region_position_to_ray, bool front_face_only, int tries_num, int max_points, Vector< float3 > &r_bary_coords, Vector< int > &r_looptri_indices, Vector< float3 > &r_positions) |
float3 | compute_bary_coord_in_triangle (const Mesh &mesh, const MLoopTri &looptri, const float3 &position) |
template<typename T > | |
T | sample_corner_attrribute_with_bary_coords (const float3 &bary_weights, const MLoopTri &looptri, const Span< T > corner_attribute) |
template<typename T > | |
static BLI_NOINLINE void | sample_point_attribute (const Mesh &mesh, const Span< int > looptri_indices, const Span< float3 > bary_coords, const VArray< T > &data_in, const IndexMask mask, const MutableSpan< T > data_out) |
template<typename T > | |
static BLI_NOINLINE void | sample_corner_attribute (const Mesh &mesh, const Span< int > looptri_indices, const Span< float3 > bary_coords, const VArray< T > &data_in, const IndexMask mask, const MutableSpan< T > data_out) |
template<typename T > | |
void | sample_face_attribute (const Mesh &mesh, const Span< int > looptri_indices, const VArray< T > &data_in, const IndexMask mask, const MutableSpan< T > data_out) |
int | sample_surface_points_projected (RandomNumberGenerator &rng, const Mesh &mesh, BVHTreeFromMesh &mesh_bvhtree, const float2 &sample_pos_re, const float sample_radius_re, const FunctionRef< void(const float2 &pos_re, float3 &r_start, float3 &r_end)> region_position_to_ray, const bool front_face_only, const int tries_num, const int max_points, Vector< float3 > &r_bary_coords, Vector< int > &r_looptri_indices, Vector< float3 > &r_positions) |
Enumerator | |
---|---|
INTERPOLATED | |
NEAREST |
Definition at line 47 of file BKE_mesh_sample.hh.
float3 blender::bke::mesh_surface_sample::compute_bary_coord_in_triangle | ( | const Mesh & | mesh, |
const MLoopTri & | looptri, | ||
const float3 & | position | ||
) |
Definition at line 421 of file mesh_sample.cc.
References MVert::co, interp_weights_tri_v3(), mesh, Mesh::mloop, Mesh::mvert, MLoopTri::tri, MLoop::v, v1, and v2.
Referenced by blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center(), and sample_surface_points_projected().
|
static |
Definition at line 63 of file mesh_sample.cc.
References BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), mask(), mesh, blender::attribute_math::mix3(), T, MLoopTri::tri, v1, and v2.
void blender::bke::mesh_surface_sample::sample_corner_attribute | ( | const Mesh & | mesh, |
Span< int > | looptri_indices, | ||
Span< float3 > | bary_coords, | ||
const GVArray & | data_in, | ||
const IndexMask | mask, | ||
GMutableSpan | data_out | ||
) |
Definition at line 91 of file mesh_sample.cc.
References BLI_assert, blender::attribute_math::convert_to_static_type(), mask(), mesh, blender::GVArrayCommon::size(), T, Mesh::totloop, blender::GMutableSpan::type(), blender::GVArrayCommon::type(), type, blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), and blender::bke::mesh_surface_sample::MeshAttributeInterpolator::sample_data().
|
inline |
Definition at line 141 of file BKE_mesh_sample.hh.
References blender::attribute_math::mix3(), and MLoopTri::tri.
Referenced by blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center(), blender::ed::sculpt_paint::AddOperationExecutor::sample_projected(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), and blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry().
void blender::bke::mesh_surface_sample::sample_face_attribute | ( | const Mesh & | mesh, |
const Span< int > | looptri_indices, | ||
const VArray< T > & | data_in, | ||
const IndexMask | mask, | ||
const MutableSpan< T > | data_out | ||
) |
Definition at line 110 of file mesh_sample.cc.
References BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), mask(), mesh, and MLoopTri::poly.
void blender::bke::mesh_surface_sample::sample_face_attribute | ( | const Mesh & | mesh, |
Span< int > | looptri_indices, | ||
const GVArray & | data_in, | ||
const IndexMask | mask, | ||
GMutableSpan | data_out | ||
) |
Definition at line 127 of file mesh_sample.cc.
References BLI_assert, blender::attribute_math::convert_to_static_type(), mask(), mesh, blender::GVArrayCommon::size(), T, Mesh::totpoly, blender::GMutableSpan::type(), blender::GVArrayCommon::type(), type, blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), and blender::bke::mesh_surface_sample::MeshAttributeInterpolator::sample_data().
|
static |
Definition at line 16 of file mesh_sample.cc.
References BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), mask(), mesh, blender::attribute_math::mix3(), Mesh::mloop, T, MLoopTri::tri, MLoop::v, v1, and v2.
void blender::bke::mesh_surface_sample::sample_point_attribute | ( | const Mesh & | mesh, |
Span< int > | looptri_indices, | ||
Span< float3 > | bary_coords, | ||
const GVArray & | data_in, | ||
const IndexMask | mask, | ||
GMutableSpan | data_out | ||
) |
Definition at line 44 of file mesh_sample.cc.
References BLI_assert, blender::attribute_math::convert_to_static_type(), mask(), mesh, blender::GVArrayCommon::size(), T, Mesh::totvert, blender::GMutableSpan::type(), blender::GVArrayCommon::type(), type, blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), and blender::bke::mesh_surface_sample::MeshAttributeInterpolator::sample_data().
int blender::bke::mesh_surface_sample::sample_surface_points_projected | ( | RandomNumberGenerator & | rng, |
const Mesh & | mesh, | ||
BVHTreeFromMesh & | mesh_bvhtree, | ||
const float2 & | sample_pos_re, | ||
const float | sample_radius_re, | ||
const FunctionRef< void(const float2 &pos_re, float3 &r_start, float3 &r_end)> | region_position_to_ray, | ||
const bool | front_face_only, | ||
const int | tries_num, | ||
const int | max_points, | ||
Vector< float3 > & | r_bary_coords, | ||
Vector< int > & | r_looptri_indices, | ||
Vector< float3 > & | r_positions | ||
) |
Definition at line 355 of file mesh_sample.cc.
References angle(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), BLI_bvhtree_ray_cast(), BVHTreeRayHit::co, compute_bary_coord_in_triangle(), KDL::cos(), BVHTreeRayHit::dist, blender::math::dot(), blender::RandomNumberGenerator::get_float(), BVHTreeRayHit::index, M_PI, mesh, BVHTreeRayHit::no, normal, blender::math::normalize(), pos, r, BVHTreeFromMesh::raycast_callback, KDL::sin(), sqrt(), and BVHTreeFromMesh::tree.
int blender::bke::mesh_surface_sample::sample_surface_points_projected | ( | RandomNumberGenerator & | rng, |
const Mesh & | mesh, | ||
BVHTreeFromMesh & | mesh_bvhtree, | ||
const float2 & | sample_pos_re, | ||
float | sample_radius_re, | ||
FunctionRef< void(const float2 &pos_re, float3 &r_start, float3 &r_end)> | region_position_to_ray, | ||
bool | front_face_only, | ||
int | tries_num, | ||
int | max_points, | ||
Vector< float3 > & | r_bary_coords, | ||
Vector< int > & | r_looptri_indices, | ||
Vector< float3 > & | r_positions | ||
) |
Find randomly distributed points on the surface of a mesh within a circle that is projected on the mesh. This does not result in an exact number of points because that would come with extra overhead and is not always possible. If an exact number of points is required, that has to be implemented at a higher level.
region_position_to_ray | Function that converts a 2D position into a 3D ray that is used to find positions on the mesh. |
mesh_bvhtree | BVH tree of the triangles in the mesh. Passed in so that it does not have to be retrieved again. |
tries_num | Number of 2d positions that are sampled. The maximum number of new samples. |
Referenced by blender::ed::sculpt_paint::AddOperationExecutor::sample_projected(), and blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry().
int blender::bke::mesh_surface_sample::sample_surface_points_spherical | ( | RandomNumberGenerator & | rng, |
const Mesh & | mesh, | ||
Span< int > | looptri_indices_to_sample, | ||
const float3 & | sample_pos, | ||
float | sample_radius, | ||
float | approximate_density, | ||
Vector< float3 > & | r_bary_coords, | ||
Vector< int > & | r_looptri_indices, | ||
Vector< float3 > & | r_positions | ||
) |
Find randomly distributed points on the surface of a mesh within a 3D sphere. This does not sample an exact number of points because it comes with extra overhead to avoid bias that is only required in some cases. If an exact number of points is required, that has to be implemented at a higher level.
approximate_density | Roughly the number of points per unit of area. |
Definition at line 264 of file mesh_sample.cc.
References angle(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), area_tri_v3(), BKE_mesh_runtime_looptri_ensure(), BKE_mesh_runtime_looptri_len(), MVert::co, KDL::cos(), blender::math::cross(), blender::math::distance_squared(), blender::RandomNumberGenerator::get_barycentric_coordinates(), blender::RandomNumberGenerator::get_float(), interp_weights_tri_v3(), isect_point_tri_prism_v3(), M_PI, mesh, min, blender::attribute_math::mix3(), Mesh::mloop, Mesh::mvert, normal, normal_tri_v3(), blender::math::normalize(), pow2f(), project_v3_plane(), r, blender::RandomNumberGenerator::round_probabilistic(), KDL::sin(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), sqrt(), MLoopTri::tri, MLoop::v, v1, v2, x, and y.
Referenced by blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), and blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry().