Return the (projected) solid angle of the facet with respect the point.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| type(vector_R8P), | intent(in) | :: | point | Point. |
Solid angle.
pure function solid_angle(self, point)
!< Return the (projected) solid angle of the facet with respect the point.
class(facet_object), intent(in) :: self !< Facet.
type(vector_R8P), intent(in) :: point !< Point.
real(R8P) :: solid_angle !< Solid angle.
type(vector_R8P) :: R1, R2, R3 !< Edges from point to facet vertices.
real(R8P) :: R1_norm, R2_norm, R3_norm !< Norms (L2) of edges from point to facet vertices.
real(R8P) :: numerator !< Archtangent numerator.
real(R8P) :: denominator !< Archtangent denominator.
R1 = self%vertex_1 - point ; R1_norm = R1%normL2()
R2 = self%vertex_2 - point ; R2_norm = R2%normL2()
R3 = self%vertex_3 - point ; R3_norm = R3%normL2()
numerator = R1.dot.(R2.cross.R3)
denominator = R1_norm * R2_norm * R3_norm + (R1.dot.R2) * R3_norm + &
(R1.dot.R3) * R2_norm + &
(R2.dot.R3) * R1_norm
solid_angle = 2._R8P * atan2(numerator, denominator)
endfunction solid_angle