public IncisionOf3DMandelbrot(Quaternion Rotater=null,ulong IterationsCount = 40UL, double LeftEdge = -2.1D, double RightEdge = 1.1D, double TopEdge = -1.1D, double BottomEdge = 1.1D)
 {
     f_iterations_count = IterationsCount;
     _2df_left_edge = LeftEdge;
     _2df_right_edge = RightEdge;
     _2df_top_edge = TopEdge;
     _2df_bottom_edge = BottomEdge;
     f_number_of_using_threads_for_parallel = Environment.ProcessorCount;
     if (Rotater == null) inc_rotater = Quaternion.Null;
     else if (Rotater.Radian == 0D) inc_rotater = Quaternion.Null;
     else if (Rotater is Quaternion.QuaternionNull) inc_rotater = Quaternion.Null;
     else inc_rotater = (Quaternion)Rotater.Clone();
     f_allow_change_iterations_count();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            int i = 0;
            double[] vector;
            lastrot.Clear();
            foreach(string str in richTextBox1.Lines)
            {

                if (str.Length < 1) continue;
                if (!checkstr(str)) { i++; continue; }
                if ((vector=getvector(str)) == null) continue;
                if (Rotater == null) Rotater = new Quaternion(GetRad(str), vector[0], vector[1], vector[2]);
                else Rotater=Rotater*new Quaternion(GetRad(str), vector[0], vector[1], vector[2]);
                lastrot.Add(str);
            }
            DialogResult = DialogResult.Yes;
            if (Rotater == null) Rotater = Quaternion.Null;
            //if (Rotater.Radian == 0) Rotater = Quaternion.Null;
            this.Dispose();
        }
예제 #3
0
 public static Quaternion operator *(Quaternion a,Quaternion b)
 {
     Quaternion result = new Quaternion();
     result._x=a._scalar*b._x+a._x*b._scalar+a._y*b._z-a._z*b._y;
     result._y=a._scalar*b._y-a._x*b._z+a._y*b._scalar+a._z*b._x;
     result._z=a._scalar*b._z+a._x*b._y-a._y*b._x+a._z*b._scalar;  //new Quaternion(addvec(addvec(mulvec(a.vec,b.vec),mulvec(a.w,b.vec)),mulvec(b.w,a.vec)));
     result._scalar = a._scalar * b._scalar - a._x * b._x - a._y * b._y - a._z * b._z; //scalarmul(a.vec, b.vec);
     return result;
 }
예제 #4
0
 private Quaternion negative_mul(Quaternion a)
 {
     Quaternion b = this;
     Quaternion result = new Quaternion();
     result._x=-a._scalar * b._x + a._x * b._scalar - a._y * b._z + a._z * b._y;
     result._y=-a._scalar*b._y+a._x*b._z+a._y*b._scalar-a._z*b._x;
     result._z=-a._scalar*b._z-a._x*b._y+a._y*b._x+a._z*b._scalar;
     result._scalar = a._scalar * b._scalar-a._x*b._x-a._y*b._y-a._z*b._z;
     return result;
 }
예제 #5
0
 public virtual double[] Rotate(double[] Vector)
 {
     if (Vector == null) throw new ArgumentNullException();
     Quaternion result;
     if (Vector.Length > 2)
         result = new Quaternion(Vector[0], Vector[1], Vector[2]);
     else if (Vector.Length > 1)
         result = new Quaternion(Vector[0], Vector[1], 0);
     else if (Vector.Length > 0)
         result = new Quaternion(Vector[0], 0, 0);
     else throw new ArgumentException();
     result=negative_mul(this * result);
     return new double[]{result._x,result._y,result._z};
 }
예제 #6
0
 public object Clone()
 {
     Quaternion result = new Quaternion();
     result._scalar = this._scalar;
     result._x = this._x;
     result._y = this._y;
     result._z = this._z;
     return result;
 }
예제 #7
0
 public static Quaternion operator +(Quaternion a,Quaternion b)
 {
     Quaternion result = new Quaternion();
     result._scalar = a._scalar + b._scalar;
     result._x = a._x + b._x;
     result._y = a._y + b._y;
     result._z = a._z + b._z;
     return result;
 }