Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CompactNdTree & Tests #9

Merged
merged 3 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Sources/QuadTree/CompactQuadTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import simd
extension simd_double2: VectorLike {


@inlinable public func distanceSquared(to: SIMD2<Scalar>) -> Scalar {
return (self-to).lengthSquared()
Expand All @@ -30,13 +29,20 @@ extension simd_double3: VectorLike {
}
}

public protocol CompactQuadTreeDelegate: NdTreeDelegate where Coordinate==simd_double2 { }
public protocol CompactOctTreeDelegate: NdTreeDelegate where Coordinate==simd_double3 { }

public typealias Vector2d = simd_double2
public typealias Vector3d = simd_double3


public protocol CompactQuadTreeDelegate: NdTreeDelegate where Coordinate==Vector2d { }
public protocol CompactOctTreeDelegate: NdTreeDelegate where Coordinate==Vector3d { }


public typealias QuadBox = NdBox<Vector2d>
public typealias OctBox = NdBox<Vector3d>


public typealias CompactQuadTree<TD: CompactQuadTreeDelegate> = CompactNdTree<simd_double2, TD>
public typealias QuadBox = NdBox<simd_double2>
public typealias CompactOctTree<TD: CompactOctTreeDelegate> = CompactNdTree<simd_double3, TD>
public typealias OctBox = NdBox<simd_double3>
public typealias CompactQuadTree<TD: CompactQuadTreeDelegate> = NdTree<Vector2d, TD>
public typealias CompactOctTree<TD: CompactOctTreeDelegate> = NdTree<Vector3d, TD>

#endif
Loading