From f7f15ba42d9a4a474e0bf8ff3f04bb66c72687b1 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Fri, 29 Jun 2018 23:32:47 -0400 Subject: [PATCH] use internal validate function --- sceneObjects/DMeshSO.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sceneObjects/DMeshSO.cs b/sceneObjects/DMeshSO.cs index 8ad35f6..c862f83 100644 --- a/sceneObjects/DMeshSO.cs +++ b/sceneObjects/DMeshSO.cs @@ -472,10 +472,7 @@ override public bool FindRayIntersection(Ray3f rayW, out SORayHit hit) if (enable_spatial == false) return false; - if (spatial == null) { - spatial = new DMeshAABBTree3(mesh); - spatial.Build(); - } + validate_spatial(); // convert ray to local FScene scene = this.GetScene(); @@ -517,10 +514,7 @@ public virtual bool FindNearest(Vector3d point, double maxDist, out SORayHit nea if (enable_spatial == false) return false; - if (spatial == null) { - spatial = new DMeshAABBTree3(mesh); - spatial.Build(); - } + validate_spatial(); // convert to local Vector3f local_pt = SceneTransforms.TransformTo((Vector3f)point, this, eInCoords, CoordSpace.ObjectCoords);