-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplane.cpp
More file actions
57 lines (41 loc) · 1.01 KB
/
Copy pathplane.cpp
File metadata and controls
57 lines (41 loc) · 1.01 KB
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
/*
* plane.cpp
* topicNet
*
* Created by basak alper on 1/8/11.
* Copyright 2011 ucsb. All rights reserved.
*
*/
#include "plane.h"
Plane :: Plane()
{
}
Plane :: Plane(int idd, double z)
:planeid(idd), depth(z)
{
}
Plane :: ~Plane()
{
}
void Plane :: addGraphNode(GraphNode * gn){
nodesonplane.push_back( gn );
}
//I need a vector helper function that removes an element with unknown index
void Plane :: removeGraphNode(GraphNode * gn){
//how do I do this without knowing the index
int pos = std::find(nodesonplane.begin(), nodesonplane.end(), gn) - nodesonplane.begin();
if( pos < nodesonplane.size() ){
//printf(" element is at position %i \n", pos);
nodesonplane.erase(nodesonplane.begin()+pos);
}
else
printf(" Plane :: removeGraphNode not found on old plane.\n");
}
void Plane :: setdepth(double z) {
depth = z ;
for (int nd=0; nd<nodesonplane.size(); nd++) {
vec3d pos = nodesonplane.at(nd)->getPos();
pos.z = depth;
nodesonplane.at(nd)->setPos(pos);
}
}