Skip to content

Hyperbolic Trajectories still problematic to display.  #390

@se5a

Description

@se5a

This is the class that does the work for drawing hyperbolic trajectories:
https://github.com/Pulsar4xDevs/Pulsar4x/blob/DevBranch/Pulsar4X/Pulsar4X.Client/OrbitalWidgets/OrbitHyperbolicIcon2.cs

Similar to how elliptical orbits are drawn,
it creates an array of points for a hyperboilc trajectory, from SOI entry to SOI exit. these points do not change throughout the objects movement.
as the object moves (each physics tick) it finds and updates _index variable to match which point in the above array is closest to the objects position.
each frame it updates an array of SDL points, from the _index to the end of the trajectory, for camera position and zoom.
it then iterates through this array drawing a line and reducing the alpha.

This has been fraught with problems, it's one of those things that on the surface should be very easy, but runs into all sorts of edge cases when dealing with angles, and I'm sick of looking at it.

  • its sometimes drawing a line to screen 0,0
  • it's sometimes not drawing to the correct length (eg end of SOI).
  • UpdateUserSettings function needs to be better so the user settings are properly handled.
  • There's probably a better way to get the closest point to the object, currently we're going to the next point or previous point so we start drawing from behind the ship, but the point may already be behind the ship meaning we're skipping a point. the way we're finding this is probably not the most efficient either.
  • it needs testing at other angles.

I suspect the first two problems are probably just array length issues.
for testing other angles you can mess around with the start position of the ship here: https://github.com/Pulsar4xDevs/Pulsar4x/blob/DevBranch/Pulsar4X/GameEngine/Engine/Factories/DefaultStartFactory.cs#L418

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions