Determinate is a point is inside or not to a polyhedron described by STL facets by means of the solid angle criteria.
STL's metrix must be already computed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(in) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | point | Point coordinates. |
Check result.
pure function is_point_inside_polyhedron_sa(self, point) result(is_inside)
!< Determinate is a point is inside or not to a polyhedron described by STL facets by means of the solid angle criteria.
!<
!< @note STL's metrix must be already computed.
class(file_stl_object), intent(in) :: self !< File STL.
type(vector_R8P), intent(in) :: point !< Point coordinates.
logical :: is_inside !< Check result.
real(R8P) :: solid_angle !< Solid angle of STL polyhedra projected on point unit sphere.
integer(I4P) :: f !< Counter.
solid_angle = 0._R8P
do f=1, self%facets_number
solid_angle = solid_angle + self%facet(f)%solid_angle(point=point)
enddo
if (solid_angle < -2._R8P * PI .or. 2._R8P * PI < solid_angle) then
is_inside = .true.
else
is_inside = .false.
endif
endfunction is_point_inside_polyhedron_sa