Visual Computing Library
All Classes Functions Variables Typedefs Enumerations Friends Modules Pages Concepts
triangle.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_CONCEPTS_SPACE_TRIANGLE_H
24#define VCL_CONCEPTS_SPACE_TRIANGLE_H
25
26#include "point.h"
27
28#include <vclib/types.h>
29
30namespace vcl {
31
37template<typename T>
38concept TriangleConcept = requires (
39 T&& obj,
40 typename RemoveRef<T>::PointType p,
41 typename RemoveRef<T>::ScalarType s) {
42 typename RemoveRef<T>::ScalarType;
43 typename RemoveRef<T>::PointType;
44
45 obj.DIM;
46 obj.size() == 3;
47
48 RemoveRef<T>(p, p, p);
49
50 { obj.point(uint()) } -> PointConcept;
51 { obj.sideLength(uint()) } -> std::same_as<decltype(s)>;
52 { obj.barycenter() } -> PointConcept;
53 { obj.perimeter() } -> std::same_as<decltype(s)>;
54 { obj.area() } -> std::same_as<decltype(s)>;
55};
56
57template<typename T>
58concept Triangle2Concept = TriangleConcept<T> && RemoveRef<T>::DIM == 2;
59
60template<typename T>
62 TriangleConcept<T> && RemoveRef<T>::DIM == 3 && requires (T&& obj) {
63 { obj.normal() } -> Point3Concept;
64 };
65
66} // namespace vcl
67
68#endif // VCL_CONCEPTS_SPACE_TRIANGLE_H
Concept for points in three-dimensional space.
Definition point.h:130
Concept for types representing points in Euclidean space.
Definition point.h:40
Definition triangle.h:58
Definition triangle.h:61
Concept for types representing triangles in Euclidean space.
Definition triangle.h:38