Ejemplo n.º 1
0
 ReturnCode draw(Domain &value) const
 {
     MSS_BEGIN(ReturnCode);
     size_t ix;
     MSS(weightDistribution_.generate(ix));
     value = drawGaussian(data_[ix], width_);
     MSS_END();
 }
Ejemplo n.º 2
0
void
CQIllustratorShape::
draw(CQIllustratorShapeDrawer *drawer) const
{
  if (getFilter() != 0)
    drawGaussian(drawer);
  else
    drawShape(drawer);

  if (getFixed()) {
    const CBBox2D &bbox = getFlatBBox();

    drawer->pathInit();
    drawer->pathMoveTo(bbox.getLL());
    drawer->pathLineTo(bbox.getUR());
    drawer->pathStroke();

    drawer->pathInit();
    drawer->pathMoveTo(bbox.getLR());
    drawer->pathLineTo(bbox.getUL());
    drawer->pathStroke();
  }
}
Ejemplo n.º 3
0
//----------------------------------------------------------------------------------------------------------------------
void SMCEnvironmentViz::update()
{
  glPushAttrib(GL_LIGHTING);
  glDisable(GL_LIGHTING);

  for(int i = 0; i < m_environment->getObjects().size(); i++)
  {
    const Positionable& obj = *m_environment->getObjects()[i];
    if(obj.isVisible())
    {
      ci::gl::color(obj.getColor());
      
      // Object specific collision detection
      if(obj.getType() == Positionable::kObj_Line)
      {
        const Line& line = (Line&)obj;
        ci::gl::drawLine(line.getStart(), line.getEnd());
      }
      else if (obj.getType() == Positionable::kObj_Triangle)
      {
        const Triangle& tri = (Triangle&)obj;        
        drawTriangle(ci::Vec3f(tri.p1), ci::Vec3f(tri.p2), ci::Vec3f(tri.p3));
      }
      else if (obj.getType() == Positionable::kObj_Circle)
      {
        const Circle& circle = (Circle&)obj;        
        ci::gl::drawSolidCircle(circle.getPosition(), circle.getRadius(), 32);
      }
      else if (obj.getType() == Positionable::kObj_Torus)
      {
        // Width specifies inflection points. For drawing we use the "half width at tenth of maximum"
        const Torus& t = (Torus&)obj;
        const ci::Vec2f& p = t.getPosition();
        glPushMatrix();
        glTranslatef(p.x, p.y, 0);
        //ci::gl::drawStrokedCircle(t.getPosition(), t.getRadius() - 2.15 * t.getWidth(), 32);
        //ci::gl::drawStrokedCircle(t.getPosition(), t.getRadius() + 2.15 * t.getWidth(), 32);
        //glColor3f(1,0,0);
        drawDisk(t.getRadius() + 2.15 * t.getWidth(), t.getRadius() - 2.15 * t.getWidth(), 32, 2, GLU_FILL);
        glPopMatrix();
      }
      else if (obj.getType() == Positionable::kObj_Gradient)
      {
        const Gradient& g = (Gradient&)obj;
        const ci::Vec2f& p = g.getPosition();
        ci::ColorA c =  ci::ColorA(1,1,1,1);
        glPushMatrix();
        glTranslatef(p.x, p.y, 0);
        drawRadialGradient(obj.getColor(), c, 32, g.getRadius());
        //glColor3f(0.9,0.9,0.9);
        //drawDisk(g.getRadius(), 0, 32, 2, GLU_SILHOUETTE);
        glPopMatrix();
      }
      else if (obj.getType() == Positionable::kObj_Gaussian)
      {
        const Gaussian& gaus = (Gaussian&)obj;        
        drawGaussian(gaus);
      }
      
#if DMX_ENV_DRAW_POS
      dmx::drawPoint(ci::Vec3f(obj.getPosition()), 4);
#endif
    }
  }
  
  glPopAttrib();
}