Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112259114
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
Fri, May 9, 10:12
Size
1 KB
Mime Type
text/x-c
Expires
Sun, May 11, 10:12 (2 d)
Engine
blob
Format
Raw Data
Handle
26056701
Attached To
rSYMKIT symkit
pendule.cpp
View Options
#include "pendule.h"
#include "models/glsphere.h"
#include "sktools.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
)
:
OscillatorShape
(
NULL
,
model
)
{
/* initialize descriptor */
pendule
=
new
PenduleS
(
p
,
p_prime
,
l
,
m
);
/* bind the descriptor */
bind
(
pendule
);
toggleFillMode
();
}
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
)
{
OscillatorShape
::
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