public void NoLod() { var chunk = new Chunk(new[] { new V3d(0, 0, 0), new V3d(1, 0, 0), new V3d(1, 1, 0), new V3d(0, 1, 0) }); var config = ImportConfig.Default .WithInMemoryStore() .WithRandomKey() .WithCreateOctreeLod(false) ; var cloud = PointCloud.Chunks(chunk, config); Assert.IsTrue(cloud.HasNormals == false); Assert.IsTrue(cloud.HasLodNormals == false); config = config .WithRandomKey() .WithEstimateNormals(ps => Normals.EstimateNormals((V3d[])ps, 5)) ; var cloud2 = cloud.GenerateNormals(config); Assert.IsTrue(cloud2.HasNormals == true); Assert.IsTrue(cloud2.Root.Value.Normals.Value.All(n => n == V3f.OOI)); Assert.IsTrue(cloud2.HasLodNormals == false); }
public void CanEstimateNormals_FromZeroToThreePoints() { var r = new Random(); for (var n = 0; n < 4; n++) { var ps = new V3f[n].SetByIndex(_ => new V3f(r.NextDouble(), r.NextDouble(), r.NextDouble())); var kd = ps.BuildKdTree(); var ns = Normals.EstimateNormals(ps, 16, kd); Assert.IsTrue(ns.Length == n); } }
public void CanEstimateNormalsWithoutKdTree() { var ps = new[] { new V3f(0, 0, 0), new V3f(1, 0, 0), new V3f(1, 1, 0), new V3f(0, 1, 0), }; var ns = Normals.EstimateNormals(ps, 16); Assert.IsTrue(ns.Length == 4); Assert.IsTrue(ns.All(n => n == V3f.ZAxis)); }