예제 #1
0
        internal static void RunGeometricReasoning(Dictionary <string, List <TessellatedSolid> > solids)
        {
            // Generate a good number of directions on the surface of a sphere
            //------------------------------------------------------------------------------------------
            //SimplifySolids(solids);
            Directions = IcosahedronPro.DirectionGeneration(1);
            DisassemblyDirections.Directions = new List <double[]>(Directions);
            FindingOppositeDirections();
            // Creating Bounding Geometries for every solid
            //------------------------------------------------------------------------------------------
            //Bridge.StatusReporter.ReportStatusMessage("Creating Bounding Geometries ... ", 1);
            BoundingGeometry.OrientedBoundingBoxDic = new Dictionary <TessellatedSolid, BoundingBox>();
            BoundingGeometry.BoundingCylinderDic    = new Dictionary <TessellatedSolid, BoundingCylinder>();
            BoundingGeometry.CreateOBB2(solids);
            BoundingGeometry.CreateBoundingCylinder(solids);
            //Bridge.StatusReporter.PrintMessage("BOUNDING GEOMETRIES ARE SUCCESSFULLY CREATED.", 0.5f);

            // Detecting Springs
            //SpringDetector.DetectSprings(solids);

            // Primitive Classification
            //------------------------------------------------------------------------------------------
            // what parts to be classified?
            var partsForPC = BlockingDetermination.PartsTobeClassifiedIntoPrimitives(solids);

            SolidPrimitive = BlockingDetermination.PrimitiveMaker(partsForPC);
        }
        internal static Dictionary <int, List <Component[]> > NonAdjacentBlocking = new Dictionary <int, List <Component[]> >(); //Component[0] is blocked by Component[1]
        internal static List <int> Run(designGraph assemblyGraph, List <TessellatedSolid> solids)
        {
            Solids     = new List <TessellatedSolid>(solids);
            Directions = IcosahedronPro.DirectionGeneration();
            var globalDirPool  = new List <int>();
            var solidPrimitive = BlockingDetermination.PrimitiveMaker(solids);

            //var gears = BoltAndGearDetection.GearDetector(solidPrimitive);

            AddingNodesToGraph(assemblyGraph, solids);//, gears, screwsAndBolts);

            /*for (var i = 0; i < solids.Count - 1; i++)
             * {
             *  var solid1 = solids[i];
             *  var solid1Primitives = solidPrimitive[solid1];
             *  for (var j = i + 1; j < solids.Count; j++)
             *  {
             *      var solid2 = solids[j];
             *      var solid2Primitives = solidPrimitive[solid2];
             *      List<int> localDirInd;
             *      double cert;
             *      if (BlockingDetermination.DefineBlocking(assemblyGraph, solid1, solid2, solid1Primitives, solid2Primitives,
             *          globalDirPool, out localDirInd, out cert))
             *      {
             *          // I wrote the code in a way that "solid1" is always "Reference" and "solid2" is always "Moving".
             *          //List<int> finDirs, infDirs;
             *          //UnconnectedBlockingDetermination.FiniteDirectionsBetweenConnectedParts(solid1, solid2, localDirInd, out finDirs, out infDirs);
             *          var from = assemblyGraph[solid2.Name]; // Moving
             *          var to = assemblyGraph[solid1.Name];   // Reference
             *          assemblyGraph.addArc((Component)from, (Component)to);
             *          var a = (Connection)assemblyGraph.arcs.Last();
             *          a.Certainty = cert;
             *          AddInformationToArc(a, localDirInd);
             *      }
             *  }
             * }*/
            return(globalDirPool);
        }