Commit 7f72f657 authored by pitiot's avatar pitiot
Browse files

up

parent bbc8a3a9
......@@ -25,6 +25,7 @@ public:
SURFACE surfaceMap; // map
VertexAttribute<VEC3, SURFACE> positionSurface ; //position
VertexAttribute<int, SURFACE> indexParticule; // index des particules de chaque sommet
EdgeAttribute<int,SURFACE> indexSegment;
void initPlane(); //initialisation d'une grille
// visualisation
......
......@@ -8,7 +8,6 @@
#include "Geometry/vector_gen.h"
#define abs(x) ((x) >= 0 ? (x) : -(x))
typedef CGoGN::Geom::Vec3f VEC3 ;
static const float RVO_EPSILON = 0.00001f ;
......@@ -25,6 +24,12 @@ inline float det2D(const VEC3& vector1, const VEC3& vector2)
}
inline float abs (float x)
{
return (x) >= 0 ? (x) : -(x);
}
// dist3D_Segment_to_Segment(): get the 3D minimum distance between 2 segments
// Input: two 3D line segments S1 and S2
// Return: the shortest distance between S1 and S2
......
......@@ -6,6 +6,7 @@ Surface::Surface(Simulator* sim,VEC3 offset)
surfaceMap.initImplicitProperties();
positionSurface = surfaceMap.addAttribute<VEC3, VERTEX, SURFACE>("positionSurface");
indexParticule = surfaceMap.addAttribute<int, VERTEX, SURFACE>("indexParticule");
indexSegment = surfaceMap.addAttribute<int, EDGE, SURFACE>("indexSegment");
initPlane();
index_articulated=sim->objects.size();
......@@ -38,7 +39,7 @@ Surface::Surface(Simulator* sim,VEC3 offset)
CGoGNout<<" init Segment :"<< nbEdges ;
CGoGNout<<" || nb_segments :"<< Segments_.size() <<CGoGNendl;
#endif
indexSegment[d]=nbEdges;
unsigned int ind1=indexParticule[d];
unsigned int ind2=indexParticule[surfaceMap.phi1(d)];
Segment* o = new Segment(parts_[ind1]->getPosition(),
......@@ -63,16 +64,16 @@ void Surface::initGL()
m_simpleColorShader->setAttributePosition(m_positionVBO);
m_simpleColorShader->setColor(Geom::Vec4f(0.,1.,0.,0.));
m_positionVBO->updateData(position) ;
m_positionVBO->updateData(positionSurface) ;
m_render->initPrimitives<PFP2>(map, Algo::Render::GL2::TRIANGLES) ;
m_render->initPrimitives<PFP2>(map, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::TRIANGLES) ;
m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::LINES) ;
}
void Surface::draw()
{
m_positionVBO->updateData(position) ;
m_positionVBO->updateData(positionSurface) ;
m_simpleColorShader->setColor(Geom::Vec4f(1.0,0.627,0.0,0.));
m_render->draw(m_simpleColorShader, Algo::Render::GL2::TRIANGLES);
......
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