예제 #1
0
        public bool MoveNext()
        {
            if (this.loop > this.steps)
            {
                return(false);
            }

            if (this.loop < this.steps)
            {
                this.current = (Essence.Geometry.Core.Double.Point2d) this.f;

                // Se calcula el siguiente paso.
                this.f         = this.f + this.fd + this.fdd_per_2 + this.fddd_per_6;
                this.fd        = this.fd + this.fdd + this.fddd_per_2;
                this.fdd_per_2 = this.fdd_per_2 + this.fddd_per_2;
                this.fdd       = this.fdd + this.fddd;
            }
            else
            {
                // El ultimo paso es exactamente el punto 3.
                this.current = this.p3;
            }

            // Se incrementa el contador.
            this.loop++;
            return(true);
        }
예제 #2
0
        public void Reset()
        {
            float t    = 1.0f / (float)this.steps;
            float temp = t * t;

            Essence.Geometry.Core.Double.Vector2d v0 = (Essence.Geometry.Core.Double.Vector2d) this.p0;
            Essence.Geometry.Core.Double.Vector2d v1 = (Essence.Geometry.Core.Double.Vector2d) this.p1;
            Essence.Geometry.Core.Double.Vector2d v2 = (Essence.Geometry.Core.Double.Vector2d) this.p2;
            Essence.Geometry.Core.Double.Vector2d v3 = (Essence.Geometry.Core.Double.Vector2d) this.p3;

            // Se inicializa las formulas.
            this.f          = v0;
            this.fd         = (v1 - v0) * (3 * t);
            this.fdd_per_2  = (v0 - 2 * v1 + v2) * (3 * temp);
            this.fddd_per_2 = (3 * (v1 - v2) + v3 - v0) * (3 * temp * t);
            this.fddd       = 2 * this.fddd_per_2;
            this.fdd        = 2 * this.fdd_per_2;
            this.fddd_per_6 = this.fddd_per_2 * (1.0f / 3.0f);

            // Se inicia el contador.
            this.loop = 0;

            this.current = null;
        }