/// <summary> /// Loads level N kdtree. If level N kdtree does not exist it is built from rootpatch. /// </summary> public static KdIntersectionTree BuildOrLoadKdTreeN(OpcPaths opcPaths, PositionsType posType, PatchFileInfo patchFileInfo) { KdIntersectionTree kdiTree = null; var kdTreeNPatch = opcPaths.GetKdTreeNPath(posType); if (!StorageConfig.FileExists(kdTreeNPatch)) { kdiTree = KdTreeUtils.BuildKdTreeForPatch(opcPaths.RootPatchName, -1, patchFileInfo, opcPaths, posType, saveTriangles: true); kdiTree.Save(opcPaths.RootPatchName); } else { kdiTree = Load.As <KdIntersectionTree>(opcPaths.GetKdTreeNPath(posType)); } return(kdiTree); }
public static void BuildKdtreeN(OpcPaths opcPaths, PositionsType posType, bool overrideExisting = false, float maxTriangleSize = float.PositiveInfinity) { var hierarchyInfo = PatchHierarchyInfo.BuildOrLoadCache(opcPaths); var patchInfo = hierarchyInfo.PatchTree.Info; opcPaths.SetRootPatchName(hierarchyInfo.RootPatch); if (posType == PositionsType.V2dPositions && !patchInfo.Has2dData) { Report.Warn("KdTreeUtils: 2d KdTreeN needs 2d data to be able to get built."); return; } if (overrideExisting || !StorageConfig.FileExists(opcPaths.GetKdTreeNPath(posType))) { BuildKdTreeForPatch(opcPaths.RootPatchName, -1, patchInfo, opcPaths, posType, true, true, maxTriangleSize); } }