diff --git a/Sources/Graph3D/Graph3D.swift b/Sources/Graph3D/Graph3D.swift index 9a4429e..7ed2fc7 100644 --- a/Sources/Graph3D/Graph3D.swift +++ b/Sources/Graph3D/Graph3D.swift @@ -63,20 +63,20 @@ public class Graph3D: GKGraph { } - internal func findNearestNode(to position: SIMD3, between nodes: [RouteVertex]) -> RouteVertex { + public func findNearestNode(to position: SIMD3, between nodes: [RouteVertex]) -> RouteVertex { let newNode = RouteVertex(position) return nodes.reduce(nodes[0]) { (best, next) -> RouteVertex in return newNode.cost(to: next) < newNode.cost(to: best) ? next : best } } - internal func findNearestNode(to position: SIMD3) -> RouteVertex { + public func findNearestNode(to position: SIMD3) -> RouteVertex { return self.findNearestNode(to: position, between: self.vertexNodes) } /// Find the closest point on the graph to a given point - internal func findPointOnEdge(from startPoint: SIMD3) -> (SIMD3, [RouteVertex]) { + public func findPointOnEdge(from startPoint: SIMD3) -> (SIMD3, [RouteVertex]) { var closestPoint = self.vertexNodes[edges[0][0]].getVectorPos() var closestDistance = startPoint.distance(to: closestPoint) var matchingNodes = [self.vertexNodes[edges[0][0]], self.vertexNodes[edges[0][1]]] diff --git a/Sources/Graph3D/RouteVertex.swift b/Sources/Graph3D/RouteVertex.swift index 4581e45..e75bb16 100644 --- a/Sources/Graph3D/RouteVertex.swift +++ b/Sources/Graph3D/RouteVertex.swift @@ -7,22 +7,22 @@ import GameplayKit.GKGraph -internal class RouteVertex: GKGraphNode3D { +public class RouteVertex: GKGraphNode3D { var travelCost: [GKGraphNode: Float] = [:] var simdPos: SIMD3 { return SIMD3(self.position) } - convenience init(position: [Float]) { + internal convenience init(position: [Float]) { self.init(point: vector_float3(position)) } - convenience init(_ position: SIMD3) { + internal convenience init(_ position: SIMD3) { self.init(point: vector_float3(position)) } - override init(point: vector_float3) { + internal override init(point: vector_float3) { super.init(point: point) }