openbsd-ports/net/ns/patches/patch-indep-utils_cmu-scen-gen_setdest_setdest_h

79 lines
2.4 KiB
Plaintext

$OpenBSD: patch-indep-utils_cmu-scen-gen_setdest_setdest_h,v 1.2 2017/05/18 23:28:53 espie Exp $
Index: indep-utils/cmu-scen-gen/setdest/setdest.h
--- indep-utils/cmu-scen-gen/setdest/setdest.h.orig
+++ indep-utils/cmu-scen-gen/setdest/setdest.h
@@ -3,7 +3,7 @@
/*#include <sys/queue.h>*/
#include "../../../config.h"
-#include "../../../lib/bsd-list.h"
+#include <sys/queue.h>
#ifndef LIST_FIRST
#define LIST_FIRST(head) ((head)->lh_first)
@@ -14,39 +14,39 @@
void ReadInMovementPattern(void);
-class vector {
+class tdvector {
public:
- vector(double x = 0.0, double y = 0.0, double z = 0.0) {
+ tdvector(double x = 0.0, double y = 0.0, double z = 0.0) {
X = x; Y = y; Z = z;
}
double length() {
return sqrt(X*X + Y*Y + Z*Z);
}
- inline void operator=(const vector a) {
+ inline void operator=(const tdvector& a) {
X = a.X;
Y = a.Y;
Z = a.Z;
}
- inline void operator+=(const vector a) {
+ inline void operator+=(const tdvector& a) {
X += a.X;
Y += a.Y;
Z += a.Z;
}
- inline int operator==(const vector a) {
+ inline int operator==(const tdvector& a) {
return (X == a.X && Y == a.Y && Z == a.Z);
}
- inline int operator!=(const vector a) {
+ inline int operator!=(const tdvector& a) {
return (X != a.X || Y != a.Y || Z != a.Z);
}
- inline vector operator-(const vector a) {
- return vector(X-a.X, Y-a.Y, Z-a.Z);
+ inline tdvector operator-(const tdvector& a) {
+ return tdvector(X-a.X, Y-a.Y, Z-a.Z);
}
- friend inline vector operator*(const double a, const vector b) {
- return vector(a*b.X, a*b.Y, a*b.Z);
+ friend inline tdvector operator*(const double a, const tdvector& b) {
+ return tdvector(a*b.X, a*b.Y, a*b.Z);
}
- friend inline vector operator/(const vector a, const double b) {
- return vector(a.X/b, a.Y/b, a.Z/b);
+ friend inline tdvector operator/(const tdvector& a, const double b) {
+ return tdvector(a.X/b, a.Y/b, a.Z/b);
}
double X;
@@ -93,9 +93,9 @@ class Node { (private)
u_int32_t index; // unique node identifier
u_int32_t first_trip; // 1 if first trip, 0 otherwise. (by J. Yoon)
- vector position; // current position
- vector destination; // destination
- vector direction; // computed from pos and dest
+ tdvector position; // current position
+ tdvector destination; // destination
+ tdvector direction; // computed from pos and dest
double speed;
double time_update; // when pos last updated