コード例 #1
0
ファイル: CurveExtruder.cs プロジェクト: unitycoder/Drawing3D
        /// <summary>
        /// overrides the <see cref="ProjectPoint(xyz)"/> method of <see cref="Surface"/>.
        /// </summary>
        /// <param name="Point">Point, wich will be projected th the surface</param>
        /// <returns>u amd v parameter. A call <b>Point</b></returns>
        public override xy  ProjectPoint(xyz Point)
        {
            xyz    p     = Base.Relativ(Point);
            xyz    PD    = new xyz(0, 0, 0);
            xyz    PU    = new xyz(0, 0, 0);
            double Lam   = -1;
            double Param = -1;

            DownPlane.Cross(new LineType(p, Direction), out Lam, out PD);
            UpPlane.Cross(new LineType(p, Direction), out Lam, out PU);

            xyzArray A = CurveArray;

            xyz R = StandardBase.Relativ(p);

            double u    = Curve.Arcus(new xy(R.X, R.y));
            xy     PP11 = Curve.Value(u);

            if (PP11.dist(new xy(R.X, R.Y)) > 0.5)
            {
            }
            else
            {
            }
            A.Distance(new LineType(p, Direction), 1e10, out Param, out Lam);
            if (Height < 0)
            {
                double v = p.dist(PD) / PU.dist(PD);

                xyz PP = Value(u, v);

                return(new xy(u, v));
            }
            else
            {
                xy       pt  = Curve.Value(u);
                xyz      K   = StandardBase.BaseX * pt.x + StandardBase.BaseY * pt.y;
                Plane    P   = new Plane(Base.BaseO, Base.BaseZ);
                LineType L   = new LineType(K, Direction);
                xyz      pkt = new xyz(0, 0, 0);
                P.Cross(L, out Lam, out pkt);
                double v   = pkt.dist(p) / Height;
                xyz    PP1 = Value(u, v);

                return(new xy(u, v));
            }
        }
コード例 #2
0
ファイル: CurveExtruder.cs プロジェクト: unitycoder/Drawing3D
        /// <summary>
        /// overrides the <see cref="Value(double, double)"/> method of a <see cref="Surface"/>.
        /// </summary>
        /// <param name="u">first u-parameter</param>
        /// <param name="v">second v-parameter</param>
        /// <returns>coordinate of the extruded object</returns>
        public override xyz Value(double u, double v)
        {
            double Lam = -1;
            xyz    Q   = new xyz(0, 0, 0);
            xy     P   = Curve.Value(u);
            xyz    K   = StandardBase.BaseO + StandardBase.BaseX * P.x + StandardBase.BaseY * P.y;

            if (Height < 0)
            {
                xyz Pkt  = new xyz(0, 0, 0);
                xyz Pkt2 = new xyz(0, 0, 0);
                DownPlane.Cross(new LineType(K, Direction), out Lam, out Pkt);
                UpPlane.Cross(new LineType(K, Direction), out Lam, out Pkt2);
                xyz N = Base.Absolut(Pkt + (Pkt2 - Pkt) * v);
                if (ZHeight(u, v) > 0)
                {
                    return(Base.Absolut(Pkt + (Pkt2 - Pkt) * v + Normal(u, v) * ZHeight(u, v)));
                }
                else
                {
                    return(Base.Absolut(Pkt + (Pkt2 - Pkt) * v));
                }
            }
            else
            {
                LineType L  = new LineType(K, Direction);
                Plane    PL = new Plane(Base.BaseO, Base.BaseZ);
                Q = new xyz(0, 0, 0);
                PL.Cross(L, out Lam, out Q);
                if (ZHeight(u, v) > 0)
                {
                    return(Q + Direction.normalized() * (Height * v) + Normal(u, v) * ZHeight(u, v));
                }
                else
                {
                    return(Q + Direction.normalized() * (Height * v));
                }
            }
        }