-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVectorWithVariables.pd
More file actions
38 lines (30 loc) · 1.35 KB
/
VectorWithVariables.pd
File metadata and controls
38 lines (30 loc) · 1.35 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
//*******************************************************
//* File: C:/Users/User/Desktop/Third Year Project/CollisionAvoidanceSystem/VectorWithVariables.pd
//* Author: Varuna
//* Created: 14:57:49 on Monday March 9th 2015 UTC
//*******************************************************
class VectorWithVariables ^=
abstract
var xconst : real;
var yconst : real;
var zconst : real;
var xt : real;
var yt : real;
var zt : real;
interface
function squareOf2DMagnitude : Equation
^= Equation{((xt ^ 2) + (yt ^ 2)),
((2 * xt * xconst) + (2 * yt * yconst)),
((xconst ^ 2) + (yconst ^ 2))};
operator +(other : VectorWithVariables) : VectorWithVariables
^= VectorWithVariables{xconst + other.xconst, yconst + other.yconst, zconst + other.zconst,
xt + other.xt, yt + other.yt, zt + other.zt};
operator -(other : VectorWithVariables) : VectorWithVariables
^= VectorWithVariables{xconst - other.xconst, yconst - other.yconst, zconst - other.zconst,
xt - other.xt, yt - other.yt, zt + other.zt};
redefine function toString : string
^= "\n (" ++ xconst.toString ++ " + " ++ xt.toString ++ "t) x + ("
++ yconst.toString ++ " + " ++ yt.toString ++ "t) y"
++ zconst.toString ++ " + " ++ zt.toString ++ "t) z";
build{!xconst : real, !yconst : real, !zconst : real, !xt : real, !yt : real, !zt : real};
end;