Lagrange
compute_area.h
1/*
2 * Copyright 2023 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
13#pragma once
14
15#include <lagrange/SurfaceMesh.h>
16
17#include <Eigen/Core>
18
19namespace lagrange {
27
32{
34 std::string_view output_attribute_name = "@facet_area";
35
37 bool use_signed_area = true;
38};
39
52template <typename Scalar, typename Index>
55 FacetAreaOptions options = {});
56
71template <typename Scalar, typename Index, int Dimension>
73 SurfaceMesh<Scalar, Index>& mesh,
74 const Eigen::Transform<Scalar, Dimension, Eigen::Affine>& transformation,
75 FacetAreaOptions options = {});
76
81{
84 std::string_view input_attribute_name = "@facet_area";
85
87 bool use_signed_area = true;
88};
89
102template <typename Scalar, typename Index>
103Scalar compute_mesh_area(
104 const SurfaceMesh<Scalar, Index>& mesh,
105 MeshAreaOptions options = {});
106
121template <typename Scalar, typename Index, int Dimension>
122Scalar compute_mesh_area(
123 const SurfaceMesh<Scalar, Index>& mesh,
124 const Eigen::Transform<Scalar, Dimension, Eigen::Affine>& transformation,
125 MeshAreaOptions options = {});
126
128} // namespace lagrange
uint32_t AttributeId
Identified to be used to access an attribute.
Definition: AttributeFwd.h:73
AttributeId compute_facet_area(SurfaceMesh< Scalar, Index > &mesh, FacetAreaOptions options={})
Compute per-facet area.
Definition: compute_area.cpp:304
Scalar compute_mesh_area(const SurfaceMesh< Scalar, Index > &mesh, MeshAreaOptions options={})
Compute mesh area.
Definition: compute_area.cpp:322
Main namespace for Lagrange.
Definition: AABBIGL.h:30
Option struct for computing per-facet area.
Definition: compute_area.h:32
std::string_view output_attribute_name
Output attribute name for facet area.
Definition: compute_area.h:34
bool use_signed_area
For 2D mesh only: whether the computed area should be signed.
Definition: compute_area.h:37
Option struct for computing mesh area.
Definition: compute_area.h:81
std::string_view input_attribute_name
Precomputed facet area attribute name.
Definition: compute_area.h:84
bool use_signed_area
For 2D mesh only: whether the computed facet area (if any) should be signed.
Definition: compute_area.h:87