Many of the SVG DOM interfaces refer to objects of class SvgPoint. An SvgPoint is an (x,y) coordinate pair. When used in matrix operations, an SvgPoint is treated as a vector of the form: [x] [y] [1]
Inheritance: ISvgPoint
Exemplo n.º 1
0
 public SvgPoint lerp(SvgPoint that, double percent)
 {
     return(new SvgPoint(
                this.x + (that.x - this.x) * percent,
                this.y + (that.y - this.y) * percent
                ));
 }
Exemplo n.º 2
0
 internal SvgSvgElement(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc)
 {
     svgExternalResourcesRequired = new SvgExternalResourcesRequired(this);
     svgFitToViewBox  = new SvgFitToViewBox(this);
     svgTests         = new SvgTests(this);
     currentTranslate = new SvgPoint(0, 0);
 }
Exemplo n.º 3
0
        public void TestLerp()
        {
            SvgPoint p2 = new SvgPoint(40,30);

            SvgPoint p3 = p.lerp(p2, 0.25);

            Assert.AreEqual(10, p.X);

            Assert.AreEqual(20, p.Y);

            Assert.AreEqual(40, p2.X);

            Assert.AreEqual(30, p2.Y);

            Assert.AreEqual(17.5, p3.X);

            Assert.AreEqual(22.5, p3.Y);
        }
Exemplo n.º 4
0
        public void TestAddition()
        {
            SvgPoint p2 = new SvgPoint(40,30);

            SvgPoint p3 = p + p2;

            Assert.AreEqual(10, p.X);

            Assert.AreEqual(20, p.Y);

            Assert.AreEqual(40, p2.X);

            Assert.AreEqual(30, p2.Y);

            Assert.AreEqual(50, p3.X);

            Assert.AreEqual(50, p3.Y);
        }
Exemplo n.º 5
0
 public SvgPoint lerp(SvgPoint that, double percent)
 {
     return(new SvgPoint(_x + (that._x - _x) * percent, _y + (that._y - _y) * percent));
 }
Exemplo n.º 6
0
 public SvgPoint lerp(SvgPoint that, double percent)
 {
     return new SvgPoint(
         this.x + (that.x - this.x)*percent,
         this.y + (that.y - this.y)*percent
     );
 }
Exemplo n.º 7
0
 public void SetUp()
 {
     p = new SvgPoint(10,20);
 }
Exemplo n.º 8
0
        public void TestSubtraction()
        {
            SvgPoint p2 = new SvgPoint(40,30);

            SvgPoint p3 = p2 - p;

            Assert.AreEqual(10, p.X);

            Assert.AreEqual(20, p.Y);

            Assert.AreEqual(40, p2.X);

            Assert.AreEqual(30, p2.Y);

            Assert.AreEqual(30, p3.X);

            Assert.AreEqual(10, p3.Y);
        }