Esempio n. 1
0
    private static void ProcessSegment(List <byte> results, Waypoint first, Waypoint second)
    {
        // -- Header -- //

        /* Dimensions are swapped to account for difference between
         * Unity and crazyflie coordinate systems
         */
        BezierDegree xDegree   = GetDegree(first, second, AxisType.Z);
        BezierDegree yDegree   = GetDegree(first, second, AxisType.X);
        BezierDegree zDegree   = GetDegree(first, second, AxisType.Y);
        BezierDegree yawDegree = BezierDegree.Constant;

        byte curveFormat = ByteUtils.Coalesce(yawDegree.Value(), zDegree.Value(), yDegree.Value(), xDegree.Value());

        results.Add(curveFormat);

        short duration = GetDuration(first, second);

        ByteUtils.Pack(results, duration, true);


        // -- Body -- //

        PackControlPoints(results, first, second, AxisType.X, xDegree);
        PackControlPoints(results, first, second, AxisType.Y, yDegree);
        PackControlPoints(results, first, second, AxisType.Z, zDegree);
    }