3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
WindRose.cpp

Generate the surface figure "windrose" that consists of cones

// Generate the surface figure "windrose" that consists of cones
#include <CoreAPI.h>
//@config: Debug
EXPORT
int main() {
// get to sculpt room
coat::ui::toRoom("Sculpt");
// add new volume
auto current = coat::Scene::sculptRoot().addChild("Wind rose");
auto volume = current.Volume();
// turn to surface
volume.toSurface();
float height = 100;
float radius = 20;
coat::cone cone1(height,radius);
coat::cone cone2(height/2,radius/2);
coat::mat4 matrix = coat::mat4::Identity;
for (int i = 0; i < 4; i++){
float alpha = i*90;
matrix = coat::mat4::RotationZ(alpha);
cone1.transform(matrix).details(0.5).add(volume);
matrix = coat::mat4::RotationZ(alpha+45);
cone2.transform(matrix).details(0.5).add(volume);
}
return 0;
}
SceneElement addChild(const char *name) const
add the child element of the same nature
static SceneElement sculptRoot()
get the root of all sculpt objects
The cone.
Definition CorePrimAPI.h:1106
prim & details(const float det_level)
set the detail level
void add(Volume &v)
add the prim into scene
prim & transform(const mat4 &t)
set the transform matrix
static void toRoom(const char *name, bool Force=false)
switch to the room
comms::cMat4 mat4
4x4 float matrix, see the cMat4
Definition CoreAPI.h:59