Lagrange
Loading...
Searching...
No Matches
PrimitiveOptions.h
1/*
2 * Copyright 2025 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#include <lagrange/internal/constants.h>
15#include <array>
16#include <cmath>
17#include <string_view>
18
19namespace lagrange::primitive {
20
23
28{
29 using Scalar = float;
30
41 std::array<Scalar, 3> center{0, 0, 0};
42
44 bool with_top_cap = true;
45
47 bool with_bottom_cap = true;
48
50 bool with_cross_section = true;
51
53 bool triangulate = false;
54
56 bool fixed_uv = false;
57
59 std::string_view normal_attribute_name = "@normal";
60
62 std::string_view uv_attribute_name = "@uv";
63
65 std::string_view semantic_label_attribute_name = "@semantic_label";
66
69 Scalar dist_threshold = static_cast<Scalar>(1e-6);
70
73 Scalar angle_threshold = static_cast<Scalar>(30 * lagrange::internal::pi / 180);
74
76 Scalar epsilon = static_cast<Scalar>(1e-6);
77
79 Scalar uv_padding = static_cast<Scalar>(0.005);
80};
81
83
84} // namespace lagrange::primitive
Common settings shared by all primitives.
Definition PrimitiveOptions.h:28
bool with_top_cap
Whether to generate top cap of the primitive (if applicable).
Definition PrimitiveOptions.h:44
Scalar uv_padding
Padding size for UV charts to avoid bleeding.
Definition PrimitiveOptions.h:79
std::array< Scalar, 3 > center
Center of the primitive in 3D space.
Definition PrimitiveOptions.h:41
std::string_view normal_attribute_name
Name of the output indexed attribute storing the normal vectors.
Definition PrimitiveOptions.h:59
bool with_cross_section
Whether to generate cross section of the primitive (if applicable).
Definition PrimitiveOptions.h:50
Scalar dist_threshold
Two vertices are considered coinciding if the distance between them is smaller than dist_threshold.
Definition PrimitiveOptions.h:69
std::string_view uv_attribute_name
Name of the output indexed attribute storing the UV coordinates.
Definition PrimitiveOptions.h:62
std::string_view semantic_label_attribute_name
Name of the output facet attribute storing the semantic labels.
Definition PrimitiveOptions.h:65
Scalar angle_threshold
An edge is considered sharp if its dihedral angle is larger than angle_threshold.
Definition PrimitiveOptions.h:73
Scalar epsilon
Numerical tolerance used for comparing Scalar values.
Definition PrimitiveOptions.h:76
bool triangulate
Whether to triangulate the generated surface mesh.
Definition PrimitiveOptions.h:53
bool with_bottom_cap
Whether to generate bottom cap of the primitive (if applicable).
Definition PrimitiveOptions.h:47
bool fixed_uv
Whether to use fixed UV coordinates regardless of the primitive parameters.
Definition PrimitiveOptions.h:56