Skip to content

Use binary search to reduce time when initializing BezierCurve #710

Closed
@CacPixel

Description

@CacPixel

Feature report check list

  • What you want is not included in the latest snapshot version of fixRTM.
  • You couldn't find same request in the issues.

Describe the feature

In original RTM, a very simple search method is used when initializing normalizedParameters: search the required result from the start of an array. It's too slow when the bezier curve is very long and it directly runs on client thread(when onChangeRailShape, editing lines) or server thread(when creating rails). Use binary search algorithm instead of the original one can reduce the time spent a lot.
I tested on my mod, 120ms->1ms when invoking initNP(), 400m long curve.
Screenshot_2024-02-26_20-10-35
Screenshot_2024-02-26_20-11-06

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestneeds-triageThe issues without maintainer's check

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions