SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLCircle.cpp
Go to the documentation of this file.
1 /**
2  * \file SLCircle.h
3  * \date July 2014
4  * \authors Marcus Hudritsch
5  * \copyright http://opensource.org/licenses/GPL-3.0
6  * \remarks Please use clangformat to format the code. See more code style on
7  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8 */
9 
10 #include <SLCircle.h>
11 
12 //-----------------------------------------------------------------------------
14  : SLPolyline(assetMgr, name)
15 {
16  SLint circlePoints = 60;
17  SLfloat deltaPhi = Utils::TWOPI / (SLfloat)circlePoints;
18 
19  SLVVec3f points;
20  for (SLint i = 0; i < circlePoints; ++i)
21  {
22  SLVec2f c;
23  c.fromPolar(1.0f, i * deltaPhi);
24  points.push_back(SLVec3f(c.x, c.y, 0));
25  }
26 
27  buildMesh(points, true, material);
28 }
29 //-----------------------------------------------------------------------------
float SLfloat
Definition: SL.h:173
string SLstring
Definition: SL.h:158
int SLint
Definition: SL.h:170
vector< SLVec3f > SLVVec3f
Definition: SLVec3.h:325
SLVec3< SLfloat > SLVec3f
Definition: SLVec3.h:318
Toplevel holder of the assets meshes, materials, textures and shaders.
SLCircle(SLAssetManager *assetMgr, SLstring name="Circle", SLMaterial *material=nullptr)
Definition: SLCircle.cpp:13
Defines a standard CG material with textures and a shader program.
Definition: SLMaterial.h:56
SLPolyline creates a polyline object.
Definition: SLPolyline.h:23
void buildMesh(const SLVVec3f &points, SLbool closed=false, SLMaterial *material=nullptr)
Definition: SLPolyline.h:38
T y
Definition: SLVec2.h:30
T x
Definition: SLVec2.h:30
void fromPolar(T r, T phiRAD)
Calculates the vector from polar coords r & phi in radians (-pi < phi < pi)
Definition: SLVec2.h:101
static const float TWOPI
Definition: Utils.h:240