WebCFace 2.5.2
Web-based Communication Framework & Dashboard-like UI
Loading...
Searching...
No Matches
geometry.h
Go to the documentation of this file.
1#pragma once
2#ifdef WEBCFACE_MESON
3#include "webcface-config.h"
4#else
5#include "webcface/common/webcface-config.h"
6#endif
7#include <vector>
8#include <type_traits>
9
15enum class GeometryType {
16 none = 0,
17 line = 1,
18 plane = 2,
19 rect = 2,
20 box = 3,
21 circle = 4,
22 cylinder = 5,
23 sphere = 6,
24 polygon = 7,
25};
26struct Geometry {
28 std::vector<double> properties;
29 Geometry() : type(GeometryType::none), properties() {}
30 Geometry(GeometryType type, const std::vector<double> &properties)
31 : type(type), properties(properties) {}
32 Geometry(GeometryType type, std::vector<double> &&properties)
33 : type(type), properties(std::move(properties)) {}
34
42 template <
43 typename GeometryDerived,
44 std::enable_if_t<std::is_constructible_v<GeometryDerived, Geometry &>,
45 std::nullptr_t> = nullptr>
46 GeometryDerived as() const {
47 return GeometryDerived{*this};
48 }
49
50 bool operator==(const Geometry &other) const {
51 return type == other.type && properties == other.properties;
52 }
53 bool operator!=(const Geometry &other) const { return !(*this == other); }
54};
55
TemporalGeometry line(const Point &begin, const Point &end)
Definition components.h:399
TemporalGeometry rect(const Point &origin, double width, double height)
Definition components.h:468
TemporalGeometry circle(const Transform &origin, double radius)
Definition components.h:524
TemporalGeometry cylinder(const Transform &origin, double radius, double length)
Definition components.h:552
TemporalGeometry plane(const Transform &origin, double width, double height)
Definition components.h:460
TemporalGeometry polygon(const std::vector< Point > &points)
Definition components.h:422
TemporalGeometry box(const Point &vertex1, const Point &vertex2)
Definition components.h:502
TemporalGeometry sphere(const Point &origin, double radius)
Definition components.h:573
GeometryType
Canvas3Dと2Dで共用、図形の種類を表す
Definition geometry.h:15
Definition geometry.h:26
Geometry(GeometryType type, const std::vector< double > &properties)
Definition geometry.h:30
std::vector< double > properties
Definition geometry.h:28
GeometryDerived as() const
各種Geometry型に変換
Definition geometry.h:46
bool operator!=(const Geometry &other) const
Definition geometry.h:53
bool operator==(const Geometry &other) const
Definition geometry.h:50
Geometry(GeometryType type, std::vector< double > &&properties)
Definition geometry.h:32
GeometryType type
Definition geometry.h:27
Geometry()
Definition geometry.h:29
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103