orbital-engine
    Preparing search index...

    Function compressVecByRatio

    • Compress a real km vector using an EXTERNALLY SUPPLIED ratio, rather than one derived from the vector's own magnitude. Needed anywhere a set of related points has to compress consistently as one shape rather than each point picking its own scale — compressDistance is a log curve, not linear, so two points at different true radii (e.g. an orbit's periapsis and apoapsis) get compressed by measurably different ratios if each computes its own from compressVec directly. For a single position that's invisible (there's only one point), but for a whole orbit path — 128 samples around the ellipse, each at a different true radius for any real (non-zero) eccentricity — independently-compressed points don't lie on a scaled copy of the true ellipse at all; the rendered ring was visibly warped and, because the ratio a body's own LIVE position used (via plain compressVec, tied to whatever radius it happened to be at, at that instant) never matched the ring's own per-point ratios either, the moving body visibly didn't sit on its own drawn orbit path. Both are fixed by using one shared ratio (see orbitCompressionRatio) for the whole orbit — the body's live position AND every point of its drawn path — so the rendered shape is a uniformly-scaled, correctly-proportioned copy of the true ellipse, and the body stays exactly on its own line.

      Parameters

      Returns WorldVec