tem_stlCubeOverlap Function

public function tem_stlCubeOverlap(stl_data, cube) result(overlaps)

Compute, if the triangles in stl intersects the cube.

Arguments

Type IntentOptional Attributes Name
type(tem_stlData_type), intent(in) :: stl_data
type(tem_cube_type), intent(in) :: cube

Return Value logical


Source Code

  function tem_stlCubeOverlap(stl_data, cube) result(overlaps)
    !--------------------------------------------------------------------------!
    type(tem_stlData_type), intent(in) :: stl_data
    type(tem_cube_type), intent(in) :: cube
    logical :: overlaps
    !--------------------------------------------------------------------------!
    integer :: iTri
    type(tem_triangle_type) :: triangle
    !--------------------------------------------------------------------------!

    overlaps = .false.
    do iTri=1, stl_data%nTris
      triangle%nodes(:,1) = stl_data%nodes( :, stl_data%tri_node(1,iTri) )
      triangle%nodes(:,2) = stl_data%nodes( :, stl_data%tri_node(2,iTri) )
      triangle%nodes(:,3) = stl_data%nodes( :, stl_data%tri_node(3,iTri) )
      overlaps = overlaps .or. tem_triangleCubeOverlap(triangle, cube)
      ! if intersection is found then terminate the loop and return overlaps
      if (overlaps) return
    end do

  end function tem_stlCubeOverlap