Search Unity

how to get the modulus of Bezier

Discussion in 'Scripting' started by happydoy, Nov 18, 2013.

  1. happydoy

    happydoy

    Joined:
    Nov 18, 2013
    Posts:
    3
    I have code for Bezier Curver,but I don't understand how to get the modulus

    the code :
    Code (csharp):
    1.  
    2.     public Vector3 GetPointAtTime( float t )
    3.  
    4.     {
    5.  
    6.         this.CheckConstant();
    7.  
    8.         float t2 = t * t;
    9.  
    10.         float t3 = t * t * t;
    11.  
    12.         float x = this.Ax * t3 + this.Bx * t2 + this.Cx * t + p0.x;
    13.  
    14.         float y = this.Ay * t3 + this.By * t2 + this.Cy * t + p0.y;
    15.  
    16.         float z = this.Az * t3 + this.Bz * t2 + this.Cz * t + p0.z;
    17.  
    18.         return new Vector3( x, y, z );
    19.  
    20.  
    21.  
    22.     }
    23.  
    24.  
    25.  
    26.     private void SetConstant()
    27.  
    28.     {
    29.  
    30. [B][COLOR="#FF8C00"][COLOR="#008000"]        this.Cx = 3f * ( ( this.p0.x + this.p1.x ) - this.p0.x );
    31.  
    32.         this.Bx = 3f * ( ( this.p3.x + this.p2.x ) - ( this.p0.x + this.p1.x ) ) - this.Cx;
    33.  
    34.         this.Ax = this.p3.x - this.p0.x - this.Cx - this.Bx;
    35.  
    36.  
    37.  
    38.         this.Cy = 3f * ( ( this.p0.y + this.p1.y ) - this.p0.y );
    39.  
    40.         this.By = 3f * ( ( this.p3.y + this.p2.y ) - ( this.p0.y + this.p1.y ) ) - this.Cy;
    41.  
    42.         this.Ay = this.p3.y - this.p0.y - this.Cy - this.By;
    43.  
    44.  
    45.  
    46.         this.Cz = 3f * ( ( this.p0.z + this.p1.z ) - this.p0.z );
    47.  
    48.         this.Bz = 3f * ( ( this.p3.z + this.p2.z ) - ( this.p0.z + this.p1.z ) ) - this.Cz;
    49.  
    50.         this.Az = this.p3.z - this.p0.z - this.Cz - this.Bz;[/COLOR][/COLOR][/B]
    51.  
    52.  
    53.  
    54.     }
    55.  
    Thanks!
     
  2. happydoy

    happydoy

    Joined:
    Nov 18, 2013
    Posts:
    3
    I want to get a 2 order Bessel,how to make it