public static Point2d ReadPoint2d(this MsgPackReader reader)
        {
            reader.ReadPrefix(TypePrefixes.FixArray);
            var x = reader.ReadDouble();
            var y = reader.ReadDouble();

            return(new Point2d(x, y));
        }
        public void DoubleTest()
        {
            MsgPackWriter writer = new MsgPackWriter(Allocator.Temp);

            writer.WriteDouble(double.MinValue);
            writer.WriteDouble(double.MaxValue);
            writer.WriteDouble(double.Epsilon);

            MsgPackReader reader = new MsgPackReader(writer.ToArray(Allocator.Temp));

            Assert.That(reader.ReadDouble(), Is.EqualTo(double.MinValue));
            Assert.That(reader.ReadDouble(), Is.EqualTo(double.MaxValue));
            Assert.That(reader.ReadDouble(), Is.EqualTo(double.Epsilon));
        }
        public static Sphere ReadSphere(this MsgPackReader reader)
        {
            var sphere = new Sphere();

            reader.ReadPrefix(TypePrefixes.FixMap);
            for (int i = 0; i < 2; i++)
            {
                var key = reader.ReadString();
                switch (key)
                {
                case "center": sphere.Center = reader.ReadPoint3d(); break;

                case "radius": sphere.Radius = reader.ReadDouble(); break;

                default: throw new InvalidOperationException(Resources.ParseError);
                }
            }
            return(sphere);
        }
        public static Ellipse ReadEllipse(this MsgPackReader reader)
        {
            var ellipse = new Ellipse();

            reader.ReadPrefix(TypePrefixes.FixMap);
            for (int i = 0; i < 3; i++)
            {
                var key = reader.ReadString();
                switch (key)
                {
                case "center": ellipse.Center = reader.ReadPoint2d(); break;

                case "angle": ellipse.Angle = reader.ReadDouble(); break;

                case "axes": ellipse.Axes = reader.ReadPoint2d(); break;

                default: throw new InvalidOperationException(Resources.ParseError);
                }
            }
            return(ellipse);
        }
        public static Circle3d ReadCircle3d(this MsgPackReader reader)
        {
            var circle = new Circle3d();

            reader.ReadPrefix(TypePrefixes.FixMap);
            for (int i = 0; i < 3; i++)
            {
                var key = reader.ReadString();
                switch (key)
                {
                case "center": circle.Center = reader.ReadPoint3d(); break;

                case "radius": circle.Radius = reader.ReadDouble(); break;

                case "normal": circle.Normal = reader.ReadPoint3d(); break;

                default: throw new InvalidOperationException(Resources.ParseError);
                }
            }
            return(circle);
        }