kOS.Suffixed.VectorRenderer.RenderPointCoords C# (CSharp) Method

RenderPointCoords() public method

Assign the arrow and label's positions in space. Call whenever :VEC, :START, or :SCALE change, or when the game switches between flight view and map view, as they don't use the same size scale.
public RenderPointCoords ( ) : void
return void
        public void RenderPointCoords()
        {
            if (line != null && hat != null)
            {
                double mapLengthMult = 1.0; // for scaling when on map view.
                double mapWidthMult = 1.0; // for scaling when on map view.
                float useWidth;

                if (isOnMap)
                {
                    mapLengthMult = ScaledSpace.InverseScaleFactor;
                    mapWidthMult = Math.Max(camLookVec.magnitude, 100.0f) / 100.0f;
                }

                Vector3d point1 = mapLengthMult * Start;
                Vector3d point2 = mapLengthMult * (Start + (Scale * 0.95 * Vector));
                Vector3d point3 = mapLengthMult * (Start + (Scale * Vector));

                label.fontSize = (int)(12.0 * (Width / 0.2) * Scale);

                useWidth = (float)(Width * Scale * mapWidthMult);

                // Position the arrow line:
                line.SetVertexCount(2);
                line.SetWidth(useWidth, useWidth);
                line.SetPosition(0, point1);
                line.SetPosition(1, point2);

                // Position the arrow hat:
                hat.SetVertexCount(2);
                hat.SetWidth(useWidth * 3.5f, 0.0F);
                hat.SetPosition(0, point2);
                hat.SetPosition(1, point3);

                // Put the label at the midpoint of the arrow:
                labelLocation = (point1 + point3) / 2;

                PutAtShipRelativeCoords();
            }
        }