Skip to content

Commit ada7019

Browse files
committed
expose findNearestNode methods and findPointOnEdge, as they can be useful being public
1 parent b88f6b9 commit ada7019

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Sources/Graph3D/Graph3D.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ public class Graph3D: GKGraph {
6363
}
6464

6565

66-
internal func findNearestNode(to position: SIMD3<Float>, between nodes: [RouteVertex]) -> RouteVertex {
66+
public func findNearestNode(to position: SIMD3<Float>, between nodes: [RouteVertex]) -> RouteVertex {
6767
let newNode = RouteVertex(position)
6868
return nodes.reduce(nodes[0]) { (best, next) -> RouteVertex in
6969
return newNode.cost(to: next) < newNode.cost(to: best) ? next : best
7070
}
7171
}
7272

73-
internal func findNearestNode(to position: SIMD3<Float>) -> RouteVertex {
73+
public func findNearestNode(to position: SIMD3<Float>) -> RouteVertex {
7474
return self.findNearestNode(to: position, between: self.vertexNodes)
7575
}
7676

7777

7878
/// Find the closest point on the graph to a given point
79-
internal func findPointOnEdge(from startPoint: SIMD3<Float>) -> (SIMD3<Float>, [RouteVertex]) {
79+
public func findPointOnEdge(from startPoint: SIMD3<Float>) -> (SIMD3<Float>, [RouteVertex]) {
8080
var closestPoint = self.vertexNodes[edges[0][0]].getVectorPos()
8181
var closestDistance = startPoint.distance(to: closestPoint)
8282
var matchingNodes = [self.vertexNodes[edges[0][0]], self.vertexNodes[edges[0][1]]]

Sources/Graph3D/RouteVertex.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77

88
import GameplayKit.GKGraph
99

10-
internal class RouteVertex: GKGraphNode3D {
10+
public class RouteVertex: GKGraphNode3D {
1111
var travelCost: [GKGraphNode: Float] = [:]
1212

1313
var simdPos: SIMD3<Float> {
1414
return SIMD3<Float>(self.position)
1515
}
1616

17-
convenience init(position: [Float]) {
17+
internal convenience init(position: [Float]) {
1818
self.init(point: vector_float3(position))
1919
}
2020

21-
convenience init(_ position: SIMD3<Float>) {
21+
internal convenience init(_ position: SIMD3<Float>) {
2222
self.init(point: vector_float3(position))
2323
}
2424

25-
override init(point: vector_float3) {
25+
internal override init(point: vector_float3) {
2626
super.init(point: point)
2727
}
2828

0 commit comments

Comments
 (0)