mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-30 07:20:30 +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:
@@ -1006,7 +1006,28 @@ class editor_mode : public application_mode, private editor_track::observer
|
||||
// adds a straight (Side 0) or a curve to the left (1) or the right (-1) at the free end of the selected track
|
||||
void extend_add(int const Side);
|
||||
void render_extend_ui();
|
||||
bool m_extend_freehand{false}; // dragging the ring of a free end draws a curve through the cursor, not a straight
|
||||
enum class track_layout
|
||||
{
|
||||
arc_straight,
|
||||
straight_arc,
|
||||
arc,
|
||||
straight
|
||||
};
|
||||
track_layout m_track_layout{track_layout::arc_straight};
|
||||
double m_join_radius{0.0};
|
||||
int m_join_variant{0};
|
||||
TTrack const *m_join_track{nullptr};
|
||||
editor_track::point_ref m_join_point;
|
||||
mutable alignment::join_result m_join_last;
|
||||
bool m_shift_wheel{false};
|
||||
bool track_wheel(double const Offset);
|
||||
std::string track_shaping(bool const Joined) const;
|
||||
void render_layout_combo();
|
||||
bool shift_straight() const;
|
||||
double design_speed(TTrack const *From, TTrack const *To) const;
|
||||
std::vector<segment_data> layout_pieces(glm::dvec3 const &Point, glm::dvec2 const &Direction, double const Grade, glm::dvec3 const &Mouse, double const Radius) const;
|
||||
std::vector<segment_data> join_pieces(TTrack const *From, editor_track::point_ref const &Frompoint, glm::dvec3 const &Start, glm::dvec2 const &Direction, editor_track::snap_target const &End, double &Length,
|
||||
std::string &Error) const;
|
||||
double m_extend_length{25.0};
|
||||
double m_extend_radius{300.0};
|
||||
bool extend_snap(editor_track::snap_target &Target) const;
|
||||
|
||||
Reference in New Issue
Block a user