Commit 1a9d8aac authored by BrutPitt's avatar BrutPitt
Browse files

ver 1.6.0 WiP - reorganize attractorsBase (h/cpp) files : move Rampe class...

ver 1.6.0 WiP - reorganize attractorsBase (h/cpp) files : move Rampe class attractors, in separate files
parent 6d935ebe
//------------------------------------------------------------------------------
// Copyright (c) 2018-2020 Michele Morrone
// All rights reserved.
//
// https://michelemorrone.eu - https://BrutPitt.com
//
// twitter: https://twitter.com/BrutPitt - github: https://github.com/BrutPitt
//
// mailto:brutpitt@gmail.com - mailto:me@michelemorrone.eu
//
// This software is distributed under the terms of the BSD 2-Clause license
//------------------------------------------------------------------------------
#include "glWindow.h"
inline float clampNormalized(float x) { return x>1.f ? 1.f : x<-1.f ? -1.f : x; }
////////////////////////////////////////////////////////////////////////////
void Rampe01::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)+cos(kVal[1].x*v.y);
vp.y = v.x*sin(kVal[0].y*v.y)+cos(kVal[1].y*v.z);
vp.z = v.y*sin(kVal[0].z*v.z)+cos(kVal[1].z*v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe02::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)+acos(clampNormalized(kVal[1].x*v.y));
vp.y = v.x*sin(kVal[0].y*v.y)+acos(clampNormalized(kVal[1].y*v.z));
vp.z = v.y*sin(kVal[0].z*v.z)+acos(clampNormalized(kVal[1].z*v.x));
}
////////////////////////////////////////////////////////////////////////////
void Rampe03::Step(vec4 &v, vec4 &vp)
{
vp.x = v.x*v.z*sin(kVal[0].x*v.x)-cos(kVal[1].x*v.y);
vp.y = v.y*v.x*sin(kVal[0].y*v.y)-cos(kVal[1].y*v.z);
vp.z = v.z*v.y*sin(kVal[0].z*v.z)-cos(kVal[1].z*v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe03A::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*v.z*sin(kVal[0].x*v.x)-cos(kVal[1].x*v.y);
vp.y = v.x*v.x*sin(kVal[0].y*v.y)-cos(kVal[1].y*v.z);
vp.z = v.y*v.y*sin(kVal[0].z*v.z)-cos(kVal[1].z*v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe04::Step(vec4 &v, vec4 &vp)
{
vp.x = v.x*sin(kVal[0].x*v.x)+cos(kVal[1].x*v.y);
vp.y = v.y*sin(kVal[0].y*v.y)+cos(kVal[1].y*v.z);
vp.z = v.z*sin(kVal[0].z*v.z)+cos(kVal[1].z*v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe05::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)+cos(kVal[1].x*v.y)+sin(kVal[2].x*v.z);
vp.y = v.x*sin(kVal[0].y*v.x)+cos(kVal[1].y*v.y)+sin(kVal[2].y*v.z);
vp.z = v.y*sin(kVal[0].z*v.x)+cos(kVal[1].z*v.y)+sin(kVal[2].z*v.z);
}
////////////////////////////////////////////////////////////////////////////
void Rampe06::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)-cos(kVal[1].x*v.y);
vp.y = v.x*sin(kVal[0].y*v.y)+cos(kVal[1].y*v.z);
vp.z = v.y*sin(kVal[0].z*v.z)-cos(kVal[1].z*v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe07::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)-cos(kVal[1].x*v.y);
vp.y = v.x*cos(kVal[0].y*v.y)+sin(kVal[1].y*v.z);
vp.z = v.y*sin(kVal[0].z*v.z)-cos(kVal[1].z*v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe08::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)-cos(v.y);
vp.y = v.x*cos(kVal[0].y*v.y)+sin(v.z);
vp.z = v.y*sin(kVal[0].z*v.z)-cos(v.x);
}
////////////////////////////////////////////////////////////////////////////
void Rampe09::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*sin(kVal[0].x*v.x)-acos(clampNormalized(kVal[1].x*v.y))+sin(kVal[2].x*v.z);
vp.y = v.x*sin(kVal[0].y*v.x)-acos(clampNormalized(kVal[1].y*v.y))+sin(kVal[2].y*v.z);
vp.z = v.y*sin(kVal[0].z*v.x)-acos(clampNormalized(kVal[1].z*v.y))+sin(kVal[2].z*v.z);
}
////////////////////////////////////////////////////////////////////////////
void Rampe10::Step(vec4 &v, vec4 &vp)
{
vp.x = v.z*v.y*sin(kVal[0].x*v.x)-cos(kVal[1].x*v.y)+asin(clampNormalized(kVal[2].x*v.z));
vp.y = v.x*v.z*sin(kVal[0].y*v.x)-cos(kVal[1].y*v.y)+ sin(kVal[2].y*v.z);
vp.z = v.y*v.x*sin(kVal[0].z*v.x)-cos(kVal[1].z*v.y)+ sin(kVal[2].z*v.z);
}
//------------------------------------------------------------------------------
// Copyright (c) 2018-2020 Michele Morrone
// All rights reserved.
//
// https://michelemorrone.eu - https://BrutPitt.com
//
// twitter: https://twitter.com/BrutPitt - github: https://github.com/BrutPitt
//
// mailto:brutpitt@gmail.com - mailto:me@michelemorrone.eu
//
// This software is distributed under the terms of the BSD 2-Clause license
//------------------------------------------------------------------------------
#pragma once
// Rampe base class
////////////////////////////////////////////////////////////////////////////
class RampeBase : public attractorVectorK
{
public:
RampeBase() {
vMin = 0.0; vMax = 0.0; kMin = -1.0; kMax = 1.0;
m_POV = vec3( 0.f, 0, 10.f);
}
protected:
void searchAttractor() { searchLyapunov(); }
};
#define RAMPE(A)\
class Rampe##A : public RampeBase {\
public:\
Rampe##A() { stepFn = (stepPtrFn) &Rampe##A::Step; }\
protected:\
void Step(vec4 &v, vec4 &vp);\
void startData(); };
RAMPE(01)
RAMPE(02)
RAMPE(03)
RAMPE(03A)
RAMPE(04)
RAMPE(05)
RAMPE(06)
RAMPE(07)
RAMPE(08)
RAMPE(09)
RAMPE(10)
#undef RAMPE
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment