PeriDyno 1.0.0
Loading...
Searching...
No Matches
SphereModel.h
Go to the documentation of this file.
1
20
21#pragma once
22#include "BasicShape.h"
23
24#include "Topology/TriangleSet.h"
25#include "Topology/PolygonSet.h"
26#include "STL/Map.h"
27
28namespace dyno
29{
30 template<typename TDataType>
31 class SphereModel : public BasicShape<TDataType>
32 {
34
35 public:
36 typedef typename TDataType::Real Real;
37 typedef typename TDataType::Coord Coord;
38
39
40
42
43 std::string caption() override { return "Sphere"; }
44
46
47 NBoundingBox boundingBox() override;
48
49 public:
50 DEF_VAR(Coord, Center, 0, "Sphere center");
51
52 DEF_VAR(Real, Radius, 0.5, "Sphere radius");
53
54 DECLARE_ENUM(SphereType,
55 Standard = 0,
56 Icosahedron = 1);
57
58 DEF_ENUM(SphereType, Type, SphereType::Standard, "Sphere type");
59
60 DEF_VAR(uint, Latitude, 32, "Latitude");
61
62 DEF_VAR(uint, Longitude, 32, "Longitude");
63
64 DEF_VAR(uint, IcosahedronStep, 1,"Step");
65
67
69
71
72 protected:
73 void resetStates() override;
74
75 private:
76 void varChanged();
77
78 void generateIcosahedron(std::vector<Vec3f>& vertices, std::vector<TopologyModule::Triangle>& triangles);
79
80 void standardSphere();
81
82 void icosahedronSphere();
83
84 };
85
86
88}
#define IMPLEMENT_TCLASS(name, T1)
Definition Object.h:103
a class to store polygon whose vertex number is greater or equal than 3
Definition PolygonSet.h:29
DEF_VAR(uint, Latitude, 32, "Latitude")
std::string caption() override
Return the caption.
Definition SphereModel.h:43
void generateIcosahedron(std::vector< Vec3f > &vertices, std::vector< TopologyModule::Triangle > &triangles)
DEF_VAR(Real, Radius, 0.5, "Sphere radius")
DEF_VAR(uint, IcosahedronStep, 1,"Step")
BasicShapeType getShapeType() override
Definition SphereModel.h:45
DECLARE_TCLASS(SphereModel, TDataType)
DEF_INSTANCE_STATE(PolygonSet< TDataType >, PolygonSet, "")
DEF_VAR(Coord, Center, 0, "Sphere center")
void resetStates() override
DECLARE_ENUM(SphereType, Standard=0, Icosahedron=1)
NBoundingBox boundingBox() override
DEF_VAR(uint, Longitude, 32, "Longitude")
TDataType::Real Real
Definition SphereModel.h:36
TDataType::Coord Coord
Definition SphereModel.h:37
DEF_ENUM(SphereType, Type, SphereType::Standard, "Sphere type")
DEF_VAR_OUT(TSphere3D< Real >, Sphere, "")
DEF_INSTANCE_STATE(TriangleSet< TDataType >, TriangleSet, "")
3D geometric primitives in three-dimensional space
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
BasicShapeType
Definition BasicShape.h:23
@ SPHERE
Definition BasicShape.h:26
@ Standard
@ Sphere
Definition VehicleInfo.h:26
unsigned int uint
Definition VkProgram.h:14