Lagrange
select_facets_in_frustum.h
1/*
2 * Copyright 2020 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#ifdef LAGRANGE_ENABLE_LEGACY_FUNCTIONS
15 #include <lagrange/legacy/select_facets_in_frustum.h>
16#endif
17
18#include <lagrange/SurfaceMesh.h>
19#include <array>
20
21namespace lagrange {
22
30
34template <typename Scalar>
35struct Frustum
36{
38 struct Plane
39 {
40 std::array<Scalar, 3> normal;
41 std::array<Scalar, 3> point;
42 };
43
45 std::array<Plane, 4> planes;
46};
47
52{
54 bool greedy = false;
55
58 std::string_view output_attribute_name = "@is_selected";
59};
60
83template <typename Scalar, typename Index>
86 const Frustum<Scalar>& frustum,
87 const FrustumSelectionOptions& options = {});
88
90
91} // namespace lagrange
bool select_facets_in_frustum(SurfaceMesh< Scalar, Index > &mesh, const Frustum< Scalar > &frustum, const FrustumSelectionOptions &options={})
Select all facets that intersect the cone/frustrum bounded by 4 planes defined by (n_i,...
Definition: select_facets_in_frustum.cpp:32
Main namespace for Lagrange.
Definition: AABBIGL.h:30
A plane defined by a normal and a point.
Definition: select_facets_in_frustum.h:39
An array of four planes that define a frustum.
Definition: select_facets_in_frustum.h:36
std::array< Plane, 4 > planes
Four planes that define a frustum.
Definition: select_facets_in_frustum.h:45
Option struct for selecting facets.
Definition: select_facets_in_frustum.h:52
bool greedy
If true, then select_facets_in_frustum will stop after it finds the first facet.
Definition: select_facets_in_frustum.h:54
std::string_view output_attribute_name
The output attribute name for the selection.
Definition: select_facets_in_frustum.h:58