コード例 #1
0
        void begin_capture(InputState input, CaptureSide eSide)
        {
            Frame3f handFrameW = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;

            lastPosS          = SceneTransforms.WorldToScene(context.Scene, handFrameW);
            startPosS         = lastPosS;
            startSocketFrameS = legSO.GetLocalFrame(CoordSpace.SceneCoords);
            startAxisS        = new Line3f(startSocketFrameS.Origin, startSocketFrameS.Y);


            if (op is EnclosedRegionOffsetOp)
            {
                EnclosedRegionOffsetOp deformOp = op as EnclosedRegionOffsetOp;
                startParam0 = deformOp.PushPullDistance;
            }
            else if (op is EnclosedRegionSmoothOp)
            {
                EnclosedRegionSmoothOp deformOp = op as EnclosedRegionSmoothOp;
                startParam0 = deformOp.OffsetDistance;
                startParam1 = deformOp.SmoothAlpha;
            }
            else if (op is PlaneBandExpansionOp)
            {
                PlaneBandExpansionOp deformOp = op as PlaneBandExpansionOp;
                startParam0 = deformOp.PushPullDistance;
                startParam1 = deformOp.BandDistance;
            }
        }
コード例 #2
0
ファイル: RadialMeasureTool.cs プロジェクト: tomleetv/gsCore
        void update_measurement()
        {
            Frame3f  localFrame = meshTarget.GetLocalFrame(CoordSpace.ObjectCoords);
            Vector3f localP     = localFrame.ToFrameP(scene.ToSceneP(measureHitPos));

            AxisAlignedBox3f bounds = meshTarget.GetLocalBoundingBox();
            Vector3f         dv     = localP - bounds.Center;

            dv.y = 0;

            Line3f   line    = new Line3f(Vector3f.Zero, Vector3f.AxisY);
            Vector3f linePos = line.ClosestPoint(localP);

            Frame3f mFrame = new Frame3f(linePos, Vector3f.AxisY);

            MeshSO.SectionInfo info = meshTarget.MeasureSection(mFrame);
            curDimension = info.maxDiameter;
            Vector3f center = 0.5f * (info.maxDiamPos1 + info.maxDiamPos2);

            //measureAxisPos = scene.ToWorldP(localFrame.FromFrameP(linePos));

            displayPosS   = localFrame.FromFrameP(linePos);
            circleCenterS = localFrame.FromFrameP(center);

            maxStart = localFrame.FromFrameP(info.maxDiamPos1);
            maxEnd   = localFrame.FromFrameP(info.maxDiamPos2);
        }
コード例 #3
0
        private void updatePath()
        {
            lines.Clear();

            var paths = CUBE.getPath(first, second);

            foreach (List <Point3f> path in paths)
            {
                if (path.Count >= 2)
                {
                    Line3f line = new Line3f(path.First(), path.Last(), new Point3f(0, 0, 1));
                    lines.Add(line);
                    // TODO: iterator
                    for (int i = 1; i < path.Count; i++)
                    {
                        line = new Line3f(path[i - 1], path[i]);
                        lines.Add(line);
                    }
                }
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: RKGekk/CCLogoSoftRender
        static void Main(string[] args)
        {
            /*
             * Vec4f a = new Vec4f(0.0f, 0.0f, -0.1f, 1.0f);
             * Mat4f prj = Mat4f.PerspectiveRH((float)(Math.PI / 180.0) * 90.0f, 1.0f, 0.1f, 1000.0f);
             * Vec4f b = prj * a;*/


            /*
             * Line2f l1 = new Line2f(1.0f, 1.0f, 2.0f, 2.0f);
             * Line2f l2 = new Line2f(1.0f, 2.0f, 2.0f, 1.0f);
             *
             * Vec2f i = l1.intersect(l2);
             * float t = l1.segmentT(l2);
             * float u = l1.segmentU(l2);
             *
             * Vec2f uu = new Vec2f(l2.t1 - l2.t0);
             * Vec2f ui = l2.t0 + uu * u;
             */
            Line3f     l1 = new Line3f(1.0f, 1.0f, 1.0f, 3.0f, 3.0f, 3.0f);
            Triangle3f t1 = new Triangle3f(
                new Vec3f(1.0f, 2.0f, 1.0f),
                new Vec3f(1.0f, 2.0f, 4.0f),
                new Vec3f(4.0f, 2.0f, 1.0f)
                );

            float d = l1.segmentD(t1);
            Vec3f j = l1.t0 + l1.normalizedDirection() * d;

            Vec3f i = l1.intersect(t1);

            string fsdf = "";


            //Vec2f v0 = new Vec2f(209.0f, 87.0f);
            //Vec2f v1 = new Vec2f(110.0f, 87.0f);
            //Vec2f v2 = new Vec2f(209.0f, 186.0f);

            //float ff = Trianglef.edgeFunction(v0, v1, v2);

            //Vec2f v0 = new Vec2f(125.0f, 22.0f);
            //Vec2f v1 = new Vec2f(82.0f, 65.0f);
            //Vec2f v2 = new Vec2f(151.0f, 91.0f);

            //Trianglef tt = new Trianglef(v0, v1, v2);
            //bool clock1 = tt.clockWise();

            //v0 = new Vec2f(125.0f, 22.0f);
            //v1 = new Vec2f(151.0f, 65.0f);
            //v2 = new Vec2f(151.0f, 91.0f);

            //tt = new Trianglef(v0, v1, v2);
            //bool clock2 = tt.clockWise();

            //Vec3f L = new Vec3f(1.0f, -1.0f, 0.0f);
            //L.normalize();
            //Vec3f N = new Vec3f(0.0f, 1.0f, 0.0f);
            //Vec3f R = L.reflect(N);
            //float l1 = R.len();
            //Vec3f Rf = L.refract(N, 1.0f / 1.333f);
            //float l2 = Rf.len();

            /*
             * string objPath = "untitled.obj";
             * FileStream objfs = File.Open(objPath, FileMode.Open, FileAccess.Read, FileShare.None);
             *
             * //string mtlPath = "untitled.mtl";
             * //FileStream mtlfs = File.Open(mtlPath, FileMode.Open, FileAccess.Read, FileShare.None);
             *
             * DataStore dataStore = new DataStore();
             * FaceParser faceParser = new FaceParser(dataStore);
             * GroupParser groupParser = new GroupParser(dataStore);
             * NormalParser normalParser = new NormalParser(dataStore);
             * TextureParser textureParser = new TextureParser(dataStore);
             * VertexParser vertexParser = new VertexParser(dataStore);
             *
             * MaterialStreamProvider materialFileStreamProvider = new MaterialStreamProvider();
             * MaterialLibraryLoader materialLibraryLoader = new MaterialLibraryLoader(dataStore);
             * MaterialLibraryLoaderFacade materialLibraryLoaderFacade = new MaterialLibraryLoaderFacade(materialLibraryLoader, materialFileStreamProvider);
             * MaterialLibraryParser materialLibraryParser = new MaterialLibraryParser(materialLibraryLoaderFacade);
             * UseMaterialParser useMaterialParser = new UseMaterialParser(dataStore);
             *
             * ObjLoader objLoader = new ObjLoader(dataStore, faceParser, groupParser, normalParser, textureParser, vertexParser, materialLibraryParser, useMaterialParser);
             *
             * var objectStream = objfs;
             * LoadResult loadResult = objLoader.Load(objectStream);
             */

            Console.ReadLine();
        }