+void PSPlanner::shrink_to_perfect_len()
+{
+ if (!this->ps().parallel())
+ return;
+ double perfect_len = this->gc().perfect_parking_slot_len();
+ if (edist(
+ this->ps().x1(), this->ps().y1(),
+ this->ps().x4(), this->ps().y4()
+ ) < perfect_len)
+ return;
+ double h = this->ps().heading();
+ h -= M_PI;
+ while (h < 0) h += 2 * M_PI;
+ double ch = perfect_len * cos(h);
+ double sh = perfect_len * sin(h);
+ this->ps().border(
+ this->ps().x4() + ch, this->ps().y4() + sh,
+ this->ps().x3() + ch, this->ps().y3() + sh,
+ this->ps().x3(), this->ps().y3(),
+ this->ps().x4(), this->ps().y4()
+ );
+}
+