|
Blender V4.3
|
Classes | |
| class | BaryWeightFromPositionFn |
| class | BaryWeightSampleFn |
| class | CornerBaryWeightFromPositionFn |
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, 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 360 of file mesh_sample.cc.
References interp_weights_tri_v3(), and v2.
Referenced by sample_barycentric_weights(), blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center(), and sample_surface_points_projected().
|
static |
Definition at line 151 of file mesh_sample.cc.
References compute_bary_coord_in_triangle().
Referenced by blender::bke::mesh_surface_sample::BaryWeightFromPositionFn::call().
|
static |
Definition at line 71 of file mesh_sample.cc.
References 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 104 of file mesh_sample.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), sample_corner_attribute(), 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 119 of file BKE_mesh_sample.hh.
References blender::bke::attribute_math::mix3().
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(), and blender::ed::sculpt_paint::AddOperationExecutor::sample_projected().
|
inline |
Definition at line 130 of file BKE_mesh_sample.hh.
References blender::bke::attribute_math::mix3().
| 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 90 of file mesh_sample.cc.
References 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 122 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 135 of file mesh_sample.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), sample_face_attribute(), 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 173 of file mesh_sample.cc.
References blender::math::distance_squared().
Referenced by blender::bke::mesh_surface_sample::CornerBaryWeightFromPositionFn::call().
|
static |
Definition at line 17 of file mesh_sample.cc.
References 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 52 of file mesh_sample.cc.
References BLI_assert, blender::bke::attribute_math::convert_to_static_type(), sample_point_attribute(), 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 34 of file mesh_sample.cc.
References blender::bke::attribute_math::mix3(), and blender::math::normalize().
| 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 292 of file mesh_sample.cc.
References 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, BVHTreeFromMesh::raycast_callback, 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_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().
| 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 200 of file mesh_sample.cc.
References 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(), 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, and y.