|
Blender V5.0
|
Classes | |
| class | BaryWeightFromPositionFn |
| class | CornerBaryWeightFromPositionFn |
| class | BaryWeightSampleFn |
Functions | |
| void | sample_point_attribute (Span< int > corner_verts, Span< int3 > corner_tris, Span< int > tri_indices, Span< float3 > bary_coords, const GVArray &src, const IndexMask &mask, GMutableSpan dst) |
| void | sample_point_normals (Span< int > corner_verts, Span< int3 > corner_tris, Span< int > tri_indices, Span< float3 > bary_coords, Span< float3 > src, IndexMask mask, MutableSpan< float3 > dst) |
| void | sample_corner_attribute (Span< int3 > corner_tris, Span< int > tri_indices, Span< float3 > bary_coords, const GVArray &src, const IndexMask &mask, GMutableSpan dst) |
| void | sample_corner_normals (Span< int3 > corner_tris, Span< int > tri_indices, Span< float3 > bary_coords, Span< float3 > src, const IndexMask &mask, MutableSpan< float3 > dst) |
| void | sample_face_attribute (Span< int > corner_tri_faces, Span< int > tri_indices, const GVArray &src, const IndexMask &mask, GMutableSpan dst) |
| int | sample_surface_points_spherical (RandomNumberGenerator &rng, const Mesh &mesh, Span< int > tris_to_sample, const float3 &sample_pos, float sample_radius, float approximate_density, Vector< float3 > &r_bary_coords, Vector< int > &r_tri_indices, Vector< float3 > &r_positions) |
| int | sample_surface_points_projected (RandomNumberGenerator &rng, const Mesh &mesh, bke::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_tri_indices, Vector< float3 > &r_positions) |
| float3 | compute_bary_coord_in_triangle (Span< float3 > vert_positions, Span< int > corner_verts, const int3 &corner_tri, const float3 &position) |
| template<typename T> | |
| T | sample_corner_attribute_with_bary_coords (const float3 &bary_weights, const int3 &corner_tri, const Span< T > corner_attribute) |
| template<typename T> | |
| T | sample_corner_attribute_with_bary_coords (const float3 &bary_weights, const int3 &corner_tri, const VArray< T > &corner_attribute) |
| template<typename T> | |
| static BLI_NOINLINE void | sample_point_attribute (const Span< int > corner_verts, const Span< int3 > corner_tris, const Span< int > tri_indices, const Span< float3 > bary_coords, const VArray< T > &src, const IndexMask &mask, const MutableSpan< T > dst) |
| template<typename T, bool check_indices = false> | |
| static BLI_NOINLINE void | sample_corner_attribute (const Span< int3 > corner_tris, const Span< int > tri_indices, const Span< float3 > bary_coords, const VArray< T > &src, const IndexMask &mask, const MutableSpan< T > dst) |
| template<typename T> | |
| void | sample_face_attribute (const Span< int > tri_faces, const Span< int > tri_indices, const VArray< T > &src, const IndexMask &mask, const MutableSpan< T > dst) |
| template<bool check_indices = false> | |
| static void | sample_barycentric_weights (const Span< float3 > vert_positions, const Span< int > corner_verts, const Span< int3 > corner_tris, const Span< int > tri_indices, const Span< float3 > sample_positions, const IndexMask &mask, MutableSpan< float3 > bary_coords) |
| template<bool check_indices = false> | |
| static void | sample_nearest_weights (const Span< float3 > vert_positions, const Span< int > corner_verts, const Span< int3 > corner_tris, const Span< int > tri_indices, const Span< float3 > sample_positions, const IndexMask &mask, MutableSpan< float3 > bary_coords) |
| 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_tri_indices, Vector< float3 > &r_positions) |
| float3 blender::bke::mesh_surface_sample::compute_bary_coord_in_triangle | ( | Span< float3 > | vert_positions, |
| Span< int > | corner_verts, | ||
| const int3 & | corner_tri, | ||
| const float3 & | position ) |
Definition at line 359 of file mesh_sample.cc.
References interp_weights_tri_v3(), and v2.
Referenced by imapaint_pick_face(), sample_barycentric_weights(), blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center(), and sample_surface_points_projected().
|
static |
Definition at line 150 of file mesh_sample.cc.
References compute_bary_coord_in_triangle(), i, and mask().
Referenced by blender::bke::mesh_surface_sample::BaryWeightFromPositionFn::call().
|
static |
Definition at line 70 of file mesh_sample.cc.
References BLI_NOINLINE, i, mask(), and sample_corner_attribute_with_bary_coords().
| void blender::bke::mesh_surface_sample::sample_corner_attribute | ( | Span< int3 > | corner_tris, |
| Span< int > | tri_indices, | ||
| Span< float3 > | bary_coords, | ||
| const GVArray & | src, | ||
| const IndexMask & | mask, | ||
| GMutableSpan | dst ) |
Definition at line 103 of file mesh_sample.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), mask(), sample_corner_attribute(), T, blender::GMutableSpan::type(), blender::GVArrayCommon::type(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), and sample_corner_attribute().
|
inline |
Definition at line 121 of file BKE_mesh_sample.hh.
References blender::bke::attribute_math::mix3(), and T.
Referenced by blender::geometry::compute_surface_point_normal(), imapaint_pick_uv(), sample_corner_attribute(), sample_corner_normals(), blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center(), blender::ed::sculpt_paint::AddOperationExecutor::sample_projected(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), and blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry().
|
inline |
Definition at line 132 of file BKE_mesh_sample.hh.
References blender::bke::attribute_math::mix3(), and T.
| void blender::bke::mesh_surface_sample::sample_corner_normals | ( | Span< int3 > | corner_tris, |
| Span< int > | tri_indices, | ||
| Span< float3 > | bary_coords, | ||
| Span< float3 > | src, | ||
| const IndexMask & | mask, | ||
| MutableSpan< float3 > | dst ) |
Definition at line 89 of file mesh_sample.cc.
References i, mask(), blender::math::normalize(), and sample_corner_attribute_with_bary_coords().
| void blender::bke::mesh_surface_sample::sample_face_attribute | ( | const Span< int > | tri_faces, |
| const Span< int > | tri_indices, | ||
| const VArray< T > & | src, | ||
| const IndexMask & | mask, | ||
| const MutableSpan< T > | dst ) |
Definition at line 121 of file mesh_sample.cc.
| void blender::bke::mesh_surface_sample::sample_face_attribute | ( | Span< int > | corner_tri_faces, |
| Span< int > | tri_indices, | ||
| const GVArray & | src, | ||
| const IndexMask & | mask, | ||
| GMutableSpan | dst ) |
Definition at line 134 of file mesh_sample.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), mask(), sample_face_attribute(), T, blender::GMutableSpan::type(), blender::GVArrayCommon::type(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), and sample_face_attribute().
|
static |
Definition at line 172 of file mesh_sample.cc.
References blender::Span< T >::begin(), blender::math::distance_squared(), i, and mask().
Referenced by blender::bke::mesh_surface_sample::CornerBaryWeightFromPositionFn::call().
|
static |
Definition at line 16 of file mesh_sample.cc.
References BLI_NOINLINE, i, mask(), and blender::bke::attribute_math::mix3().
| void blender::bke::mesh_surface_sample::sample_point_attribute | ( | Span< int > | corner_verts, |
| Span< int3 > | corner_tris, | ||
| Span< int > | tri_indices, | ||
| Span< float3 > | bary_coords, | ||
| const GVArray & | src, | ||
| const IndexMask & | mask, | ||
| GMutableSpan | dst ) |
Definition at line 51 of file mesh_sample.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), mask(), sample_point_attribute(), T, blender::GMutableSpan::type(), blender::GVArrayCommon::type(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), and sample_point_attribute().
| void blender::bke::mesh_surface_sample::sample_point_normals | ( | Span< int > | corner_verts, |
| Span< int3 > | corner_tris, | ||
| Span< int > | tri_indices, | ||
| Span< float3 > | bary_coords, | ||
| Span< float3 > | src, | ||
| IndexMask | mask, | ||
| MutableSpan< float3 > | dst ) |
Definition at line 33 of file mesh_sample.cc.
References i, mask(), blender::bke::attribute_math::mix3(), and blender::math::normalize().
| int blender::bke::mesh_surface_sample::sample_surface_points_projected | ( | RandomNumberGenerator & | rng, |
| const Mesh & | mesh, | ||
| bke::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_tri_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_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_tri_indices, | ||
| Vector< float3 > & | r_positions ) |
Definition at line 291 of file mesh_sample.cc.
References angle(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_bvhtree_ray_cast(), BVHTreeRayHit::co, compute_bary_coord_in_triangle(), BVHTreeRayHit::dist, blender::math::dot(), FLT_MAX, blender::RandomNumberGenerator::get_float(), BVHTreeRayHit::index, M_PI, BVHTreeRayHit::no, blender::math::normalize(), pos, blender::bke::BVHTreeFromMesh::raycast_callback, and blender::bke::BVHTreeFromMesh::tree.
| int blender::bke::mesh_surface_sample::sample_surface_points_spherical | ( | RandomNumberGenerator & | rng, |
| const Mesh & | mesh, | ||
| Span< int > | tris_to_sample, | ||
| const float3 & | sample_pos, | ||
| float | sample_radius, | ||
| float | approximate_density, | ||
| Vector< float3 > & | r_bary_coords, | ||
| Vector< int > & | r_tri_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 199 of file mesh_sample.cc.
References angle(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), area_tri_v3(), blender::math::cross(), blender::math::distance_squared(), blender::RandomNumberGenerator::get_barycentric_coordinates(), blender::RandomNumberGenerator::get_float(), i, interp_weights_tri_v3(), isect_point_tri_prism_v3(), M_PI, blender::bke::attribute_math::mix3(), normal_tri_v3(), blender::math::normalize(), pow2f(), project_v3_plane(), blender::RandomNumberGenerator::round_probabilistic(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), v2, x, and y.
Referenced by blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry().