Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121730926
pendule.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 13, 11:06
Size
1 KB
Mime Type
text/x-c
Expires
Tue, Jul 15, 11:06 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27378244
Attached To
rSYMKIT symkit
pendule.cpp
View Options
#include "pendule.h"
#include "models/glsphere.h"
#include "graphtools.h"
using
namespace
symkit
;
#ifndef M_PI
#define M_PI 3.141592654
#endif
const
Vector
Pendule
::
p
=
{
M_PI
/
2
};
const
Vector
Pendule
::
p_prime
=
{
-
M_PI
/
4
};
const
double
Pendule
::
l
=
5.0
;
const
double
Pendule
::
m
=
1.0
;
Pendule
::
Pendule
(
models
::
GLSphere
*
model
)
:
OscillatorParticle
(
NULL
,
model
)
{
/* initialize descriptor */
pendule
=
new
PenduleS
(
p
,
p_prime
,
l
,
m
);
/* bind the descriptor */
bind
(
pendule
);
/* set fill mode to false (default true) */
toggleFillMode
();
/* set evolving to true (default false) */
toggleEvolving
();
}
Pendule
::~
Pendule
()
{
/* Release descriptor */
release
();
delete
pendule
;
}
#include "skerror.h"
using
namespace
symkit
;
void
Pendule
::
initialize
()
{
if
(
!
isBound
())
throw
SKError
(
ERR_INIT
,
"initialize"
,
"alpha.Pendule"
,
"Descriptor isn't bound"
);
}
#include "assets.h"
// colorGradientFunction
/* set color */
void
Pendule
::
evolve
(
float
)
{
setColor
(
alpha
::
colorGradientFunction
(
pendule
->
getp_prime
().
module
(),
3.0
)
);
}
#include <QGLShaderProgram>
/* draw/render function */
void
Pendule
::
render
(
render_s
args
)
{
OscillatorParticle
::
render
(
args
);
glBegin
(
GL_LINES
);
args
.
shaderProgram
->
setAttributeValue
(
AttributeID
::
vertex
,
ARRAY_3D_FLOAT_ARGS
(
SVector
<
3
>::
nullv
));
// center
args
.
shaderProgram
->
setAttributeValue
(
AttributeID
::
vertex
,
ARRAY_3D_FLOAT_ARGS
(
-
position
()
));
glEnd
();
}
Event Timeline
Log In to Comment