예제 #1
0
ConvexPoly ConvexPoly::
transform(const Transform &xform)
{
  std::vector<Vector> xvs;
  for (size_t i = 0; i < vs.size(); i++) {
    xvs.push_back(xform * vs[i]);
  }
  return ConvexPoly(xvs, &color);
}
예제 #2
0
ConvexPoly
Rectangle(const Vector &v1, const Vector &v2, 
const Color *color)
{
  std::vector<Vector> vs;
  vs.push_back(Vector(fmin(v1.x, v2.x), fmin(v1.y, v2.y)));
  vs.push_back(Vector(fmax(v1.x, v2.x), fmin(v1.y, v2.y)));
  vs.push_back(Vector(fmax(v1.x, v2.x), fmax(v1.y, v2.y)));
  vs.push_back(Vector(fmin(v1.x, v2.x), fmax(v1.y, v2.y)));
  return ConvexPoly(vs, color);
}
예제 #3
0
파일: poly.cpp 프로젝트: crmxm/oclRender
ConvexPoly
Rectangle(const Vector &vertex1, const Vector &vertex2, 
          const Color * inputColorPointer, bool positive)
{
    std::vector<Vector> vertices;
    vertices.push_back(Vector(fmin(vertex1.x, vertex2.x), fmin(vertex1.y, vertex2.y)));
    vertices.push_back(Vector(fmax(vertex1.x, vertex2.x), fmin(vertex1.y, vertex2.y)));
    vertices.push_back(Vector(fmax(vertex1.x, vertex2.x), fmax(vertex1.y, vertex2.y)));
    vertices.push_back(Vector(fmin(vertex1.x, vertex2.x), fmax(vertex1.y, vertex2.y)));
    return ConvexPoly(vertices, inputColorPointer, positive);
}
예제 #4
0
ConvexPoly
LineSegment(const Vector &v1, const Vector &v2, 
      float thickness, const Color *color)
{
  Vector d = v2 - v1;
  float tmp = d.x;
  d.x = -d.y;
  d.y = tmp;
  d = d * (thickness / d.length() / 2);
  std::vector<Vector> vs;
  vs.push_back(v1 + d);
  vs.push_back(v1 - d);
  vs.push_back(v2 - d);
  vs.push_back(v2 + d);
  return ConvexPoly(vs, color);
}
예제 #5
0
파일: poly.cpp 프로젝트: crmxm/oclRender
ConvexPoly
LineSegment(const Vector &vertex1, const Vector &vertex2, float thickness, 
            const Color *inputColorPointer, bool positive)
{
    Vector d = vertex2 - vertex1;
    float tmp = d.x;
    d.x = -d.y;
    d.y = tmp;
    d = d * (thickness / d.Length() / 2);
    std::vector<Vector> vertices;
    vertices.push_back(vertex1 + d);
    vertices.push_back(vertex1 - d);
    vertices.push_back(vertex2 - d);
    vertices.push_back(vertex2 + d);
    return ConvexPoly(vertices, inputColorPointer, positive);
}
예제 #6
0
ConvexPoly 
Triangle(const std::vector<Vector> &ps, const Color *color)
{
	return ConvexPoly(ps, color);
}
예제 #7
0
파일: poly.cpp 프로젝트: crmxm/oclRender
ConvexPoly 
Triangle(const std::vector<Vector> &vertices, const Color * inputColorPointer, bool positive)
{
    return ConvexPoly(vertices, inputColorPointer, positive);
}