Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112307449
ressor.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, 20:53
Size
1 KB
Mime Type
text/x-c
Expires
Sun, May 11, 20:53 (2 d)
Engine
blob
Format
Raw Data
Handle
26065908
Attached To
rSYMKIT symkit
ressor.cpp
View Options
#define _USE_SVECTOR_OSTREAM
#include "ressor.h"
#include <iostream>
#include <QGLShaderProgram>
#include "descriptors/ressort.h"
#include "models/glsphere.h"
#include "sktools.h"
using namespace symkit;
using namespace std;
const Vector Ressor::p = {0};
const Vector Ressor::p_prime = {10};
const Vector Ressor::axys = {1, -0.5, 1};
const double Ressor::l = 0.0;
const double Ressor::m = 1.0;
const double Ressor::k = 0.5;
Ressor::Ressor(models::GLSphere * model)
: OscillatorShape(NULL, model)
{
/* initialize descriptor */
ressort = new Ressort(p, p_prime, axys, l, m, k);
/* bind the descriptor */
bind(ressort);
toggleFillMode();
}
Ressor::~Ressor()
{
/* release descriptor */
release();
/* delete descriptor */
delete ressort;
}
#include "assets.h" // colorGradientFunction
/* set color */
void Ressor::evolve(float)
{
setColor( alpha::colorGradientFunction(ressort->getp_prime().module(), 15.0) );
}
#include "skerror.h"
using namespace symkit;
void Ressor::initialize()
{
if (!isBound())
throw SKError(ERR_INIT,
"initialize",
"alpha.Ressor"
"Descriptor ins't bound");
}
/* draw/render function */
void Ressor::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