source: vtkvis/trunk/Arc.h @ 5214

Last change on this file since 5214 was 3696, checked in by ldelgass, 11 years ago

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.

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2004-2012  HUBzero Foundation, LLC
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef VTKVIS_ARC_H
9#define VTKVIS_ARC_H
10
11#include <vtkSmartPointer.h>
12#include <vtkPolyDataMapper.h>
13#include <vtkActor.h>
14#include <vtkArcSource.h>
15
16#include "Shape.h"
17#include "DataSet.h"
18
19namespace VtkVis {
20
21/**
22 * \brief VTK PolyData Arc
23 *
24 * This class creates a arc
25 */
26class Arc : public Shape
27{
28public:
29    Arc();
30    virtual ~Arc();
31
32    virtual const char *getClassName() const
33    {
34        return "Arc";
35    }
36
37    void setCenter(double center[3])
38    {
39        if (_arc != NULL) {
40            _arc->SetCenter(center);
41        }
42    }
43
44    void setStartPoint(double pt[3])
45    {
46        if (_arc != NULL) {
47            double polarVec[3];
48            for (int i = 0; i < 3; i++) {
49                polarVec[i] = pt[i] - _arc->GetCenter()[i];
50            }
51            setPolarVector(polarVec);
52        }
53    }
54
55    void setNormal(double norm[3])
56    {
57        if (_arc != NULL) {
58            _arc->SetNormal(norm);
59        }
60    }
61
62    void setPolarVector(double vec[3])
63    {
64        if (_arc != NULL) {
65            _arc->SetPolarVector(vec);
66        }
67    }
68
69    void setAngle(double angle)
70    {
71        if (_arc != NULL) {
72            _arc->SetAngle(angle);
73        }
74    }
75
76    void setResolution(int res)
77    {
78        if (_arc != NULL) {
79            _arc->SetResolution(res);
80        }
81    }
82
83private:
84    virtual void update();
85
86    vtkSmartPointer<vtkArcSource> _arc;
87};
88
89}
90
91#endif
Note: See TracBrowser for help on using the repository browser.