Beispiel #1
0
        /// <summary>
        /// 判断点是否在弧上
        /// </summary>
        /// <param name="v"></param>
        /// <param name="tol"></param>
        /// <returns></returns>
        public bool contain(Vector3D v, double tol = 1e-6)
        {
            TransformationFunctionPolar tf = new TransformationFunctionPolar(
                this._center,
                0);
            Vector3D v1 = tf.trans(v);

            if (Math.Abs(v1.y - this.radius) > tol)
            {
                return(false);
            }

            //
            this.theta1 = Vector3D.equivalent_angle1(this.theta1);
            this.theta2 = Vector3D.equivalent_angle1(this.theta2);
            v1.x        = Vector3D.equivalent_angle1(v1.x);
            if (this.theta2 > this.theta1)
            {
                return(this.theta1 < v1.x + tol && v1.x - tol < this.theta2);
            }
            else
            {
                //double t1 = 0.0;
                double t2 = this.theta2 - this.theta1;
                t2 = Vector3D.equivalent_angle1(t2);
                double t = Vector3D.equivalent_angle1(v1.x - this.theta1);
                return(t < t2 + tol);
            }
        }
Beispiel #2
0
        public Vector3D calc_nearest_point(Vector3D v, out bool flag_in, out double lc, double tol = 1e-6)
        {
            TransformationFunctionPolar tf = new TransformationFunctionPolar(
                this._center,
                0);
            Vector3D zb = tf.trans(v);
            Vector3D n  = new Vector3D(zb.x, this.radius);

            lc = Vector3D.equivalent_angle1(n.x - this.theta1) * this.radius;
            Vector3D rt = tf.itrans(n);

            flag_in = this.contain(rt, tol);
            return(rt);
        }