mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 22:07:28 +01:00
feat(editor): two free ends joined without loops or forced curves, the shape from a free end on the wheel
- the join of two free ends (a drag from one onto the other, or a click of the lay tool on it) tries in turn: a straight when the joints check can't see the kinks (half its angle), one circular arc through both ends (a piece cut out of a curve comes back as it was, its cant kept), a curve with straights where the tangents meet, a reverse curve, and only then a free Bezier curve; a curve turning more than it needs to, sharper than 10 m or longer than three chords is never taken - the transition curves eased out of a curved neighbour only when there's room for them between the ends, never crossing each other into a loop - cant and transition curves recommended for the radius the curve really gets, at the speed of the joined track or of the tool and never above what the radius allows; the circular arc keeps at least max(20 m, 0.4 V) between the transitions, the cant lowered to what the shortened transitions can ramp, transitions under 1 m left out - shapes from a free end: arc then straight, straight then arc, arc through the cursor, straight; Ctrl+wheel steps the radius, Shift+wheel the shape (at a free end: the other joins), the plain wheel still zooms; a click of the lay tool from a free end lays the shape and goes on from its end - self-test commands join, layto and joints; Polish translation
This commit is contained in:
@@ -35,6 +35,8 @@ struct limits
|
||||
double vertical_factor{0.4};
|
||||
double vertical_min{2000.0};
|
||||
double tangent_min_time{0.0};
|
||||
double arc_min{20.0};
|
||||
double arc_min_factor{0.4};
|
||||
};
|
||||
|
||||
struct compound_arc
|
||||
@@ -164,6 +166,8 @@ struct result
|
||||
};
|
||||
|
||||
result compute(design const &Design);
|
||||
double speed_limit(double const Radius, limits const &Limits);
|
||||
result compute_recommended(design &Design, bool const Transitions);
|
||||
bool tangent_intersection(design const &Design, glm::dvec2 &Point);
|
||||
bool collinear(design const &Design);
|
||||
|
||||
@@ -184,4 +188,49 @@ std::size_t minimum_pieces(result const &Result, design const &Design);
|
||||
std::vector<segment_data> pieces(result const &Result, design const &Design, std::size_t const Count, std::vector<double> const &Breaks = {}, std::vector<std::size_t> const &Counts = {},
|
||||
std::vector<std::size_t> *Intervals = nullptr);
|
||||
|
||||
struct join_end
|
||||
{
|
||||
glm::dvec3 position{0.0};
|
||||
glm::dvec2 direction{0.0, 1.0};
|
||||
double roll{0.0};
|
||||
};
|
||||
|
||||
enum class join_kind
|
||||
{
|
||||
none,
|
||||
straight,
|
||||
arc,
|
||||
curve,
|
||||
reverse_curve,
|
||||
bezier
|
||||
};
|
||||
|
||||
struct join_request
|
||||
{
|
||||
join_end start;
|
||||
join_end end;
|
||||
double radius{0.0};
|
||||
int variant{0};
|
||||
bool transitions{false};
|
||||
double speed{100.0};
|
||||
double kink{0.1};
|
||||
transition_shape shape{transition_shape::cubic_parabola};
|
||||
limits norms;
|
||||
};
|
||||
|
||||
struct join_result
|
||||
{
|
||||
join_kind kind{join_kind::none};
|
||||
std::vector<segment_data> pieces;
|
||||
double length{0.0};
|
||||
double radius{0.0};
|
||||
double cant{0.0};
|
||||
double transition{0.0};
|
||||
double speed{0.0};
|
||||
int variants{0};
|
||||
std::vector<std::string> warnings;
|
||||
};
|
||||
|
||||
join_result join(join_request const &Request);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user