4 // kinematic constraints
5 bool BicycleCar::drivable(BicycleCar *bc)
8 pow(this->ccl()->x() - bc->x(), 2)
9 + pow(this->ccl()->y() - bc->y(), 2)
10 <= pow(this->mtr(), 2)
14 pow(this->ccr()->x() - bc->x(), 2)
15 + pow(this->ccr()->y() - bc->y(), 2)
16 <= pow(this->mtr(), 2)
22 double BicycleCar::iradi()
27 double BicycleCar::ofradi()
32 double BicycleCar::orradi()
38 double BicycleCar::lfx()
40 double lfx = this->x();
41 lfx += (this->w() / 2) * cos(this->h() + M_PI / 2);
42 lfx += this->df() * cos(this->h());
43 lfx += this->sd() * cos(this->h());
47 double BicycleCar::lfy()
49 double lfy = this->y();
50 lfy += (this->w() / 2) * sin(this->h() + M_PI / 2);
51 lfy += this->df() * sin(this->h());
52 lfy += this->sd() * sin(this->h());
56 double BicycleCar::lrx()
58 double lrx = this->x();
59 lrx += (this->w() / 2) * cos(this->h() + M_PI / 2);
60 lrx += -this->dr() * cos(this->h());
61 lrx += -this->sd() * cos(this->h());
65 double BicycleCar::lry()
67 double lry = this->y();
68 lry += (this->w() / 2) * sin(this->h() + M_PI / 2);
69 lry += -this->dr() * sin(this->h());
70 lry += -this->sd() * sin(this->h());
74 double BicycleCar::rrx()
76 double rrx = this->x();
77 rrx += (this->w() / 2) * cos(this->h() - M_PI / 2);
78 rrx += -this->dr() * cos(this->h());
79 rrx += -this->sd() * cos(this->h());
83 double BicycleCar::rry()
85 double rry = this->y();
86 rry += (this->w() / 2) * sin(this->h() - M_PI / 2);
87 rry += -this->dr() * sin(this->h());
88 rry += -this->sd() * sin(this->h());
92 double BicycleCar::rfx()
94 double rfx = this->x();
95 rfx += (this->w() / 2) * cos(this->h() - M_PI / 2);
96 rfx += this->df() * cos(this->h());
97 rfx += this->sd() * cos(this->h());
101 double BicycleCar::rfy()
103 double rfy = this->y();
104 rfy += (this->w() / 2) * sin(this->h() - M_PI / 2);
105 rfy += this->df() * sin(this->h());
106 rfy += this->sd() * sin(this->h());
110 double BicycleCar::ralx()
112 double lrx = this->x();
113 lrx += (this->w() / 2) * cos(this->h() + M_PI / 2);
116 double BicycleCar::raly()
118 double lry = this->y();
119 lry += (this->w() / 2) * sin(this->h() + M_PI / 2);
123 double BicycleCar::rarx()
125 double rrx = this->x();
126 rrx += (this->w() / 2) * cos(this->h() - M_PI / 2);
130 double BicycleCar::rary()
132 double rry = this->y();
133 rry += (this->w() / 2) * sin(this->h() - M_PI / 2);
137 BicycleCar *BicycleCar::ccl()
139 BicycleCar *bc = new BicycleCar();
140 bc->x(this->x() + this->mtr() * cos(this->h() + M_PI / 2));
141 bc->y(this->y() + this->mtr() * sin(this->h() + M_PI / 2));
146 BicycleCar *BicycleCar::ccr()
148 BicycleCar *bc = new BicycleCar();
149 bc->x(this->x() + this->mtr() * cos(this->h() - M_PI / 2));
150 bc->y(this->y() + this->mtr() * sin(this->h() - M_PI / 2));
156 void BicycleCar::next()
158 if (this->st() > this->wb() / this->mtr())
159 this->st(this->wb() / this->mtr());
160 if (this->st() < -this->wb() / this->mtr())
161 this->st(-this->wb() / this->mtr());
162 this->h(this->h() + this->sp() / this->wb() * tan(this->st()));
163 this->x(this->x() + this->sp() * cos(this->h()));
164 this->y(this->y() + this->sp() * sin(this->h()));
167 BicycleCar::BicycleCar()