|
Blender V5.3
|
Classes | |
| class | NearestCornerFromPositionFn |
| 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, const bke::bvh::Tree &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> | |
| 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_nearest_corner (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< int > nearest_corner) |
| int | sample_surface_points_projected (RandomNumberGenerator &rng, const Mesh &mesh, const bke::bvh::Tree &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 340 of file mesh_sample.cc.
References compute_bary_coord_in_triangle(), blender::interp_weights_tri_v3(), position, and blender::v2.
Referenced by blender::bke::bvh::Tree::closest_point(), compute_bary_coord_in_triangle(), blender::ed::sculpt_paint::imapaint_pick_face(), blender::bke::bvh::Tree::ray_intersect(), blender::bke::bvh::Tree::ray_intersect_all(), blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center(), sample_surface_points_projected(), and sample_surface_points_projected().
|
static |
Definition at line 85 of file mesh_sample.cc.
References BLI_NOINLINE, blender::exec_mode::grain_size(), sample_corner_attribute(), 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 116 of file mesh_sample.cc.
References blender::BLI_assert(), sample_corner_attribute(), T, blender::bke::attribute_math::to_static_type(), blender::GMutableSpan::type(), blender::GVArrayCommon::type(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::bke::mesh_surface_sample::BaryWeightSampleFn::call(), blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), sample_corner_attribute(), sample_corner_attribute(), and blender::bke::sample_corner_attributes().
|
inline |
Definition at line 121 of file BKE_mesh_sample.hh.
References blender::bke::attribute_math::mix3(), sample_corner_attribute_with_bary_coords(), and T.
Referenced by blender::geometry::compute_surface_point_normal(), blender::ed::sculpt_paint::imapaint_pick_uv(), sample_corner_attribute(), sample_corner_attribute_with_bary_coords(), sample_corner_attribute_with_bary_coords(), 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(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), 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(), sample_corner_attribute_with_bary_coords(), 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 100 of file mesh_sample.cc.
References blender::exec_mode::grain_size(), blender::math::normalize(), sample_corner_attribute_with_bary_coords(), and sample_corner_normals().
Referenced by blender::geometry::add_curves_on_mesh(), and sample_corner_normals().
| 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 133 of file mesh_sample.cc.
References blender::exec_mode::grain_size(), and sample_face_attribute().
| 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 148 of file mesh_sample.cc.
References blender::BLI_assert(), sample_face_attribute(), T, blender::bke::attribute_math::to_static_type(), blender::GMutableSpan::type(), blender::GVArrayCommon::type(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::bke::mesh_surface_sample::BaryWeightSampleFn::call(), blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), sample_face_attribute(), and sample_face_attribute().
|
static |
Definition at line 163 of file mesh_sample.cc.
References blender::math::distance_squared(), and sample_nearest_corner().
Referenced by blender::bke::mesh_surface_sample::NearestCornerFromPositionFn::call(), and sample_nearest_corner().
|
static |
Definition at line 21 of file mesh_sample.cc.
References BLI_NOINLINE, blender::exec_mode::grain_size(), blender::bke::attribute_math::mix3(), and sample_point_attribute().
| 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 60 of file mesh_sample.cc.
References blender::BLI_assert(), sample_point_attribute(), T, blender::bke::attribute_math::to_static_type(), blender::GMutableSpan::type(), blender::GVArrayCommon::type(), blender::GMutableSpan::typed(), and blender::GVArray::typed().
Referenced by blender::bke::mesh_surface_sample::BaryWeightSampleFn::call(), blender::nodes::node_geo_distribute_points_on_faces_cc::interpolate_attribute(), sample_point_attribute(), sample_point_attribute(), and blender::bke::sample_vertex_attributes().
| 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 40 of file mesh_sample.cc.
References blender::exec_mode::grain_size(), blender::bke::attribute_math::mix3(), blender::math::normalize(), and sample_point_normals().
Referenced by sample_point_normals().
| int blender::bke::mesh_surface_sample::sample_surface_points_projected | ( | RandomNumberGenerator & | rng, |
| const Mesh & | mesh, | ||
| const bke::bvh::Tree & | 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 281 of file mesh_sample.cc.
References angle(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), compute_bary_coord_in_triangle(), blender::math::dot(), blender::RandomNumberGenerator::get_float(), blender::IndexRange::IndexRange(), M_PI, blender::math::normalize(), blender::bke::bvh::Tree::ray_intersect(), and sample_surface_points_projected().
| int blender::bke::mesh_surface_sample::sample_surface_points_projected | ( | RandomNumberGenerator & | rng, |
| const Mesh & | mesh, | ||
| const bke::bvh::Tree & | 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.
| mesh_bvhtree | BVH tree of the triangles in the mesh. Passed in so that it does not have to be retrieved again. |
| region_position_to_ray | Function that converts a 2D position into a 3D ray that is used to find positions on the mesh. |
| tries_num | Number of 2d positions that are sampled. The maximum number of new samples. |
References compute_bary_coord_in_triangle(), position, and sample_surface_points_projected().
Referenced by blender::ed::sculpt_paint::AddOperationExecutor::sample_projected(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), sample_surface_points_projected(), and sample_surface_points_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 189 of file mesh_sample.cc.
References angle(), blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::area_tri_v3(), bary_coord, blender::math::cross(), blender::math::distance_squared(), blender::RandomNumberGenerator::get_barycentric_coordinates(), blender::RandomNumberGenerator::get_float(), blender::IndexRange::IndexRange(), blender::interp_weights_tri_v3(), blender::isect_point_tri_prism_v3(), M_PI, blender::bke::attribute_math::mix3(), blender::normal_tri_v3(), blender::math::normalize(), blender::pow2f(), blender::project_v3_plane(), blender::RandomNumberGenerator::round_probabilistic(), sample_surface_points_spherical(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::v2, blender::x, and y.
Referenced by blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_spherical_with_symmetry(), and sample_surface_points_spherical().