4 // kinematic constraints
5 bool BicycleCar::drivable(BicycleCar *bc)
11 double BicycleCar::lfx()
13 double lfx = this->x();
14 lfx += (this->w() / 2) * cos(this->h() + M_PI / 2);
15 lfx += this->df() * cos(this->h());
16 lfx += this->sd() * cos(this->h());
20 double BicycleCar::lfy()
22 double lfy = this->y();
23 lfy += (this->w() / 2) * sin(this->h() + M_PI / 2);
24 lfy += this->df() * sin(this->h());
25 lfy += this->sd() * sin(this->h());
29 double BicycleCar::lrx()
31 double lrx = this->x();
32 lrx += (this->w() / 2) * cos(this->h() + M_PI / 2);
33 lrx += -this->dr() * cos(this->h());
34 lrx += -this->sd() * cos(this->h());
38 double BicycleCar::lry()
40 double lry = this->y();
41 lry += (this->w() / 2) * sin(this->h() + M_PI / 2);
42 lry += -this->dr() * sin(this->h());
43 lry += -this->sd() * sin(this->h());
47 double BicycleCar::rrx()
49 double rrx = this->x();
50 rrx += (this->w() / 2) * cos(this->h() - M_PI / 2);
51 rrx += -this->dr() * cos(this->h());
52 rrx += -this->sd() * cos(this->h());
56 double BicycleCar::rry()
58 double rry = this->y();
59 rry += (this->w() / 2) * sin(this->h() - M_PI / 2);
60 rry += -this->dr() * sin(this->h());
61 rry += -this->sd() * sin(this->h());
65 double BicycleCar::rfx()
67 double rfx = this->x();
68 rfx += (this->w() / 2) * cos(this->h() - M_PI / 2);
69 rfx += this->df() * cos(this->h());
70 rfx += this->sd() * cos(this->h());
74 double BicycleCar::rfy()
76 double rfy = this->y();
77 rfy += (this->w() / 2) * sin(this->h() - M_PI / 2);
78 rfy += this->df() * sin(this->h());
79 rfy += this->sd() * sin(this->h());
83 double BicycleCar::ralx()
85 double lrx = this->x();
86 lrx += (this->w() / 2) * cos(this->h() + M_PI / 2);
89 double BicycleCar::raly()
91 double lry = this->y();
92 lry += (this->w() / 2) * sin(this->h() + M_PI / 2);
96 double BicycleCar::rarx()
98 double rrx = this->x();
99 rrx += (this->w() / 2) * cos(this->h() - M_PI / 2);
103 double BicycleCar::rary()
105 double rry = this->y();
106 rry += (this->w() / 2) * sin(this->h() - M_PI / 2);
110 BicycleCar *BicycleCar::ccl()
112 BicycleCar *bc = new BicycleCar();
113 bc->x(this->x() + this->mtr() * cos(this->h() + M_PI / 2));
114 bc->y(this->y() + this->mtr() * sin(this->h() + M_PI / 2));
119 BicycleCar *BicycleCar::ccr()
121 BicycleCar *bc = new BicycleCar();
122 bc->x(this->x() + this->mtr() * cos(this->h() - M_PI / 2));
123 bc->y(this->y() + this->mtr() * sin(this->h() - M_PI / 2));
129 void BicycleCar::next()
131 if (this->st() > this->wb() / this->mtr())
132 this->st(this->wb() / this->mtr());
133 if (this->st() < -this->wb() / this->mtr())
134 this->st(-this->wb() / this->mtr());
135 this->h(this->h() + this->sp() / this->wb() * tan(this->st()));
136 this->x(this->x() + this->sp() * cos(this->h()));
137 this->y(this->y() + this->sp() * sin(this->h()));
140 BicycleCar::BicycleCar()