-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathPlane.h
62 lines (50 loc) · 1.39 KB
/
Plane.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// Plane.h
//
// Created by @madelinegannon on 11/18/20.
//
//
#pragma once
#include "ofMain.h"
namespace ofxRobotArm{
class Plane{
public:
ofVec3f axis;
ofNode pose;
float size = 100;
void update(ofNode pose){
this->pose.setGlobalPosition(pose.getGlobalPosition());
this->pose.setGlobalOrientation(pose.getGlobalOrientation());
}
void update(ofVec3f position, ofQuaternion orientation){
this->pose.setGlobalPosition(position);
this->pose.setGlobalOrientation(orientation);
}
void draw(ofColor fill = ofColor::yellow, ofColor line = ofColor::cyan){
ofPushStyle();
ofPushMatrix();
ofMultMatrix(pose.getGlobalTransformMatrix());
ofSetLineWidth(3);
ofDrawAxis(size);
ofFill();
ofSetColor(fill, 100);
ofBeginShape();
ofVertex(-size/2,-size/2,0);
ofVertex(size/2,-size/2, 0);
ofVertex(size/2,size/2, 0);
ofVertex(-size/2,size/2,0);
ofEndShape(OF_CLOSE);
ofSetLineWidth(1);
ofSetColor(line);
ofNoFill();
ofBeginShape();
ofVertex(-size/2,-size/2,0);
ofVertex(size/2,-size/2, 0);
ofVertex(size/2,size/2, 0);
ofVertex(-size/2,size/2,0);
ofEndShape(OF_CLOSE);
ofPopMatrix();
ofPopStyle();
}
};
}