Пример #1
0
        public void TestNormals()
        {
            var mdlReader         = new MdlFilePolygonDataReader(_inputPath + @"\flowerpetals.mdl");
            var triangles         = Triangle.GetTrianglesFromPts(mdlReader.Points);
            var meshGeometryModel = PaulBourkeSmoother.CreateMeshGeometry3DFromTriangles(triangles);

            Assert.AreEqual(0, meshGeometryModel.Normals.Count);
            XamlWriter.SaveMeshGeometryModel(_outputPath + @"\ModelWithoutSetNormals.xaml", meshGeometryModel, Color.FromRgb(255, 255, 0));

            NormalCalculator.SetNormalsForModel(meshGeometryModel);

            Assert.AreEqual(meshGeometryModel.Positions.Count, meshGeometryModel.Normals.Count);

            XamlWriter.SaveMeshGeometryModel(_outputPath + @"\ModelWithSetNormals.xaml", meshGeometryModel, Color.FromRgb(255, 255, 0));

            var normalModelPts = new List <Point3D>();

            for (var index = 0; index < meshGeometryModel.Normals.Count; index++)
            {
                var normal   = meshGeometryModel.Normals[index];
                var position = meshGeometryModel.Positions[index];

                var p2 = new Point3D(position.X + normal.X, position.Y + normal.Y, position.Z + normal.Z);

                var lineModel = LineDisplayModel.GetLineModel(position, p2, .03);
                normalModelPts.AddRange(lineModel);
            }
            XamlWriter.WritePolygonsToXamlFile("", _outputPath + @"\NormalsAsLines.xaml", normalModelPts, false);
        }
Пример #2
0
 public void WriteToLineDisplay(LineDisplayModel data)
 {
     Task.Run(() =>
     {
         Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                               () =>
         {
             if (CacheBusinessLogic.UseCustomerDisplay)
             {
                 if (CacheBusinessLogic.UseOposCustomerDisplay)
                 {
                     WriteToOPOSLineDisplay(data?.OposText1, data?.OposText2);
                 }
                 else
                 {
                     WriteToNonOPOSLineDisplay(data?.NonOposTexts);
                 }
             }
         });
     });
 }