상속: IPath
예제 #1
0
    public BezierInfo(Vector3[] points)
    {
        Vector3 p0 = points[0];
        Vector3 c  = points[1];
        Vector3 p1 = points[2];

        qBezier = new QBezier(p0.x, p0.y, p0.z,
                              c.x, c.y, c.z,
                              p1.x, p1.y, p1.z);
    }
예제 #2
0
 public BezierInfo(Vector3[] points, Quaternion rot0, Quaternion rot1)
 {
     Vector3 p0 = points[0];
     Vector3 c  = points[1];
     Vector3 p1 = points[2];
     qBezier = new QBezier(	p0.x, p0.y, p0.z,
                             c.x, c.y, c.z,
                             p1.x, p1.y, p1.z,
                           rot0, rot1
                           );
 }
예제 #3
0
    public BezierInfo(Vector3[] points, Quaternion rot0, Quaternion rot1)
    {
        Vector3 p0 = points[0];
        Vector3 c  = points[1];
        Vector3 p1 = points[2];

        qBezier = new QBezier(p0.x, p0.y, p0.z,
                              c.x, c.y, c.z,
                              p1.x, p1.y, p1.z,
                              rot0, rot1
                              );
    }
예제 #4
0
    /**
     * Clone
     */
    public QBezier clone()
    {
        QBezier c = new QBezier(_x0, _y0, _z0, _cx, _cy, _cz, _x1, _y1, _z1);

        if (float.IsNaN(_length) == false)
        {
            c._length = _length;
            c.XY      = XY;
            c.B       = B;
            c.C       = C;
            c.CS      = CS;
            c.CS2     = CS2;
            c.INTG_0  = INTG_0;
        }
        return(c);
    }
예제 #5
0
    public void end()
    {
        b__command     = (PathType[])__command.ToArray(typeof(PathType));
        b__coordinates = (float[])__coordinates.ToArray(typeof(float));
        b__quats       = (Quaternion[])__quats.ToArray(typeof(Quaternion));

        int      cmd_len = __cmd_index;
        PathType c;
        int      ci   = 0;
        int      roti = 0;
        float    x;
        float    y;
        float    z;
        float    px     = 0;
        float    py     = 0;
        float    pz     = 0;
        int      path_i = 0;

        __length = 0;
        for (int i = 0; i < cmd_len; i++)
        {
            c = b__command[i];
            switch (c)
            {
            case PathType.__MOVE_TO:
                px  = b__coordinates[ci];
                py  = b__coordinates[ci + 1];
                pz  = b__coordinates[ci + 2];
                ci += 3;
                break;

            case PathType.__LINE_TO:
                x = b__coordinates[ci];
                y = b__coordinates[ci + 1];
                z = b__coordinates[ci + 2];
                PathLine pline = new PathLine(px, py, pz, x, y, z, b__quats[roti], b__quats[roti + 1]);
                //__path[path_i] = pline;
                __path.Add(pline);
                __length += pline.length;
                //__path_length[path_i] = __length;
                __path_length.Add(__length);
                path_i++;
                px    = x;
                py    = y;
                pz    = z;
                ci   += 3;
                roti += 1;
                break;

            case PathType.__CURVE_TO:
                x = b__coordinates[ci + 3];
                y = b__coordinates[ci + 4];
                z = b__coordinates[ci + 5];
                QBezier pbezier = new QBezier(px, py, pz, b__coordinates[ci], b__coordinates[ci + 1], b__coordinates[ci + 2], x, y, z, b__quats[roti], b__quats[roti + 1]);
                //__path[path_i] = pbezier;
                __path.Add(pbezier);
                __length += pbezier.length;
                //__path_length[path_i] = __length;
                __path_length.Add(__length);
                path_i++;
                px    = x;
                py    = y;
                pz    = z;
                ci   += 6;
                roti += 1;
                break;
            }
        }

        b__path        = (IPath[])__path.ToArray(typeof(IPath));
        b__path_length = (float[])__path_length.ToArray(typeof(float));
    }
예제 #6
0
    public void end()
    {
        b__command = (PathType[])__command.ToArray( typeof(PathType) );
        b__coordinates = (float[])__coordinates.ToArray( typeof(float) );
        b__quats = (Quaternion[])__quats.ToArray( typeof(Quaternion) );

        int cmd_len = __cmd_index;
        PathType c;
        int ci = 0;
        int roti = 0;
        float x;
        float y;
        float z;
        float px = 0;
        float py = 0;
        float pz = 0;
        int path_i = 0;
        __length = 0;
        for ( int i = 0; i < cmd_len; i++ )
        {
            c = b__command[i];
            switch( c )
            {
                case PathType.__MOVE_TO:
                    px = b__coordinates[ci];
                    py = b__coordinates[ci + 1];
                    pz = b__coordinates[ci + 2];
                    ci += 3;
                    break;

                case PathType.__LINE_TO:
                    x = b__coordinates[ci];
                    y = b__coordinates[ci + 1];
                    z = b__coordinates[ci + 2];
                    PathLine pline = new PathLine( px, py, pz, x, y, z, b__quats[roti], b__quats[roti+1] );
                    //__path[path_i] = pline;
                    __path.Add( pline );
                    __length += pline.length;
                    //__path_length[path_i] = __length;
                    __path_length.Add( __length );
                    path_i++;
                    px = x;
                    py = y;
                    pz = z;
                    ci += 3;
                    roti += 1;
                    break;

                case PathType.__CURVE_TO:
                    x = b__coordinates[ci + 3];
                    y = b__coordinates[ci + 4];
                    z = b__coordinates[ci + 5];
                    QBezier pbezier =  new QBezier( px, py, pz, b__coordinates[ci], b__coordinates[ci + 1], b__coordinates[ci + 2], x, y, z, b__quats[roti], b__quats[roti+1] );
                    //__path[path_i] = pbezier;
                    __path.Add( pbezier );
                    __length += pbezier.length;
                    //__path_length[path_i] = __length;
                    __path_length.Add( __length );
                    path_i++;
                    px = x;
                    py = y;
                    pz = z;
                    ci += 6;
                    roti += 1;
                    break;
            }
        }

        b__path = (IPath[])__path.ToArray( typeof(IPath) );
        b__path_length = (float[])__path_length.ToArray( typeof(float) );
    }
예제 #7
0
    /**
     * Clone
     */
    public QBezier clone()
    {
        QBezier c = new QBezier(_x0, _y0, _z0, _cx, _cy, _cz, _x1, _y1, _z1, _rot0, _rot1);

        if (float.IsNaN(_length) == false) {
            c._length = _length;
            c.XY = XY;
            c.B = B;
            c.C = C;
            c.CS = CS;
            c.CS2 = CS2;
            c.INTG_0 = INTG_0;
        }
        return c;
    }