示例#1
0
        public static bool reflectRaysOverRangeOfMotion(Component2 component)
        {
            // what we want to do is reflect rays while moving through all positions.
            // if we get to a position where we can't see it anymore, we want to call it a day
            // TODO : we could probably try lengthening the flag here and checking

            Extrusion e = new Extrusion(component, RayTracer.camera, swApp, swDoc, swAssembly, swFeatureMgr);

            if (e.isValid())
            {
                bool completeSimulation = false;
                int  positionsTested    = 0;

                double originalMateValue = getMateValue(component);

                while (!completeSimulation && (RayTracer.reflectedRayCanSeeComponent(component) != null))
                {
                    positionsTested += 1;

                    // move to a new position
                    moveToPosition(component, positionsTested, originalMateValue);

                    completeSimulation = isSimulationComplete(component.Name2, positionsTested);
                }

                moveToPosition(component, 0, originalMateValue);

                if (completeSimulation)
                {
                    return(true);
                }
            }
            else
            {
                // we have something like a scroll wheel or trackball
                // these things don't need to be simulated
                return(RayTracer.reflectedRayCanSeeComponent(component) != null);
            }

            return(false);
        }
示例#2
0
        private bool placeMirror(Component2 swComponent)
        {
            // intutively, what we want to do:
            // look to see if any camera rays hit the object as-is, then no worries
            // if not, look to see if any camera rays reflecting off the main body hit the object
            //   if yes, put a mirror in that spot
            //   if no, we fail and cry

            if (!Simulator.reflectRaysOverRangeOfMotion(swComponent))
            {
                return(false);
            }

            // TODO : ideally we would collect all the points that we reflect
            // from and make a mirror that shows all of them
            ReflectionPoint rp = RayTracer.reflectedRayCanSeeComponent(swComponent);

            createMirrorExtrusion(rp);

            return(true);
        }