Ignore:
Timestamp:
Jun 17, 2013 1:48:27 AM (11 years ago)
Author:
ldelgass
Message:

Use imroved Arc API (arc can only represent a circular section, and setting
two endpoints could cause problems with endpts and center colinear and radii
from center to two endpoints differing). New API uses a center, start point,
normal and sweep angle. Also change Line to support polylines: protocol is
changed to require a Tcl list for point coordinates instead of a fixed 2
endpoints.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/Line.h

    r3621 r3696  
    99#define VTKVIS_LINE_H
    1010
     11#include <vector>
     12
    1113#include <vtkSmartPointer.h>
    1214#include <vtkPolyDataMapper.h>
    1315#include <vtkActor.h>
    1416#include <vtkLineSource.h>
     17#include <vtkPoints.h>
    1518
    1619#include "Shape.h"
     
    2225 * \brief VTK PolyData Line
    2326 *
    24  * This class creates a line
     27 * This class creates a polyline
    2528 */
    2629class Line : public Shape
     
    3538    }
    3639
     40    /**
     41     * \brief This interface creates a single line
     42     */
    3743    void setEndPoints(double pt1[3], double pt2[3])
    3844    {
    3945        if (_line != NULL) {
    4046            _line->SetPoint1(pt1);
    41             _line->SetPoint2(pt2);
    42         }
     47            _line->SetPoint2(pt2);
     48            _line->SetPoints(NULL);
     49        }
     50    }
     51
     52    /**
     53     * \brief This interface creates a polyline
     54     */
     55    void setPoints(std::vector<double> pts)
     56    {
     57        if (_line == NULL)
     58            return;
     59        vtkPoints *points = vtkPoints::New();
     60        for (size_t i = 0; i < pts.size(); i+=3) {
     61            points->InsertNextPoint(pts[i], pts[i+1], pts[i+2]);
     62        }
     63        _line->SetPoints(points);
    4364    }
    4465
Note: See TracChangeset for help on using the changeset viewer.