示例#1
0
void Poly::drawLineNumbers() const
{
  Vector3d v,v2;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    v2 = getVertexCircular3(i+1);
    ostringstream oss;
    oss << i;
    Render::draw_string((v+v2)/2., oss.str());
  }
}
示例#2
0
文件: poly.cpp 项目: atoun/repsnapper
void Poly::getLines(vector<Vector3d> &lines, uint startindex) const
{
  size_t count = vertices.size();
  if (count<2) return; // one point no line
  if (count<3) count--; // two points one line
  for(size_t i=0;i<count;i++)
    {
      lines.push_back(getVertexCircular3(i+startindex));
      lines.push_back(getVertexCircular3(i+startindex+1));
    }
}
示例#3
0
void Poly::drawLineNumbers() const
{
  Vector3d v,v2;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    v2 = getVertexCircular3(i+1);
    ostringstream oss;
    oss << i;
    renderBitmapString((v+v2)/2., GLUT_BITMAP_8_BY_13 , oss.str());
  }
}
示例#4
0
// add to lines starting with given index
// closed lines sequence
void Poly::getLines(vector<printline> &plines, uint startindex) const
{
  size_t count = vertices.size();
  if (count<2) return; // one point no line
  if (count<3) count--; // two points one line
  for(size_t i=0;i<count;i++)
    {
      struct printline pline;
      pline.from = getVertexCircular3(i+startindex);
      pline.to = getVertexCircular3(i+startindex+1);
      pline.extrusionfactor = extrusionfactor ;
      plines.push_back(pline);
    }
}
示例#5
0
void Poly::transform(const Matrix4d &T) {
  for (uint i = 0; i < vertices.size();  i++) {
    const Vector3d v = T * getVertexCircular3(i) ;
    vertices[i].set(v.x(),v.y());
  }
  setZ((T * Vector3d(0,0,z)).z());
  calcHole();
}
示例#6
0
void Poly::makeLines(vector<Vector3d> &lines, uint startindex) const
{
  vector<Vector3d> mylines;
  size_t count = vertices.size();
  if (count<2) return; // one point no line
  bool closedlines = closed;
  if (count<3) closedlines = false; // two points one line
  for(size_t i = startindex; i < count+startindex; i++)
    {
      if (!closedlines && i == count-1) continue;
      lines.push_back(getVertexCircular3(i));
      lines.push_back(getVertexCircular3(i+1));
    }
  if (!closedlines && startindex == count-1)
    lines.insert(lines.end(),mylines.rbegin(),mylines.rend());
  else
    lines.insert(lines.end(),mylines.begin(),mylines.end());
}
示例#7
0
void Poly::drawVertexNumbers() const
{
  Vector3d v;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    glVertex3f(v.x(),v.y(),v.z());
    ostringstream oss;
    oss << i;
    Render::draw_string(v, oss.str());
  }
}
示例#8
0
void Poly::drawVertexNumbers() const
{
  Vector3d v;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    glVertex3f(v.x,v.y,v.z);
    ostringstream oss;
    oss << i;
    renderBitmapString(v, GLUT_BITMAP_8_BY_13 , oss.str());
  }
}
示例#9
0
void Poly::drawVertexAngles() const
{
  Vector3d v;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    glVertex3f(v.x(),v.y(),v.z());
    double angle = angleAtVertex(i);
    ostringstream oss;
    oss << (int)(angle*180/M_PI);
    Render::draw_string(v, oss.str());
  }
}
示例#10
0
void Poly::draw(int gl_type, bool reverse) const
{
  Vector3d v;//,vn,m,dir;
  uint count = vertices.size();
  glBegin(gl_type);	  
  for (uint i=0;i < count;i++){
    if (reverse){
      v = getVertexCircular3(-i);
      // vn = getVertexCircular3(-i-1);
    } else {
      v = getVertexCircular3(i);
      // vn = getVertexCircular3(i+1);
    }
    glVertex3f(v.x,v.y,v.z);
    // if (gl_type==GL_LINE_LOOP){
    //   m = (v+vn)/2;
    //   dir = m + rotatedZ((vn-v)/10,M_PI/2);
    //   glVertex3f(dir.x,dir.y,z);
    // }
  }
  glEnd();
}