Пример #1
0
        public Vector3D shadeDividedRho(Collision collision)
        {
            var      hemiSampler = hemiSamplerFactory.makeSampler();
            Vector3D wi          = SamplerUtil.sampleWi(collision.normal, hemiSampler, randomFactory);
            Vector3D li          = tracer.traceRay(new Ray(collision.point, wi), lightFilter);

            return(MathUtil.multiply(colorDiffuse, li));
        }
Пример #2
0
        public Dataset(string source, string target, List <Sampler> samplers)
        {
            _sourceDir = SamplerUtil.GetAbsoluteFilePath(source);
            _targetDir = SamplerUtil.GetAbsoluteFilePath(target);

            foreach (var sampler in samplers)
            {
                AddSampler(sampler);
            }
        }
Пример #3
0
        public void Sample(string ifcPath, Action <string, string> exportDelegate, Action <List <string> > vocabUpdaterDelegate)
        {
            if (!SamplerUtil.IsValidIfcFile(ifcPath))
            {
                throw new FileNotFoundException("The specified IFC file is either invalid or cannot be found.");
            }

            try
            {
                using (var model = IfcStore.Open(ifcPath))
                {
                    log.InfoFormat("Sampling the file with a {0}...", GetType().Name);
                    ExportData(model, exportDelegate, vocabUpdaterDelegate);
                }
            }
            catch (Exception e)
            {
                log.ErrorFormat("Failed to load the file: {0}", e.Message);
            }
        }
        private void ProcessTree()
        {
            double maxSize    = SamplerUtil.Max(_boundingBox.SizeX, _boundingBox.SizeY, _boundingBox.SizeZ);
            double _looseNess = 1.2;

            _tree = new XbimOctree <int>(maxSize / _looseNess, ScaleOrder, _looseNess, _boundingBox.Centroid());

            foreach (int label in _bboxBuffer.Keys)
            {
                _tree.Add(label, _bboxBuffer[label]);
            }

            XbimRect3D treeBox = _tree.ContentBounds();

            if (SamplerUtil.BBoxEqual(treeBox, _boundingBox))
            {
                log.Info("Tree was successfully populated");
            }
            else
            {
                log.Error("Tree bounds do not match the boundingbox of the model !");
            }
        }
Пример #5
0
        public void ExportData(IfcStore model, Action <string, string> exportDelegate, Action <List <string> > vocabMerger)
        {
            int numCollections = 0;
            Action <List <string> > collectionSampler = (collection) => {
                collection = SamplerUtil.ProcessCollection(collection);
                vocabMerger.Invoke(collection);//add the collection to the global vocabulary
                foreach (string label in collection)
                {
                    foreach (string target in collection)
                    {
                        if (label == target)
                        {
                            continue;
                        }
                        exportDelegate.Invoke(label, target);
                    }
                }
                numCollections++;
            };

            SampleCollections(model, collectionSampler);
            log.InfoFormat("Finished sampling {0} collections", numCollections);
        }