darkma773r commented on a change in pull request #194:
URL: https://github.com/apache/commons-geometry/pull/194#discussion_r825459133



##########
File path: 
commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/PointMap3DImpl.java
##########
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.geometry.euclidean;
+
+import java.util.List;
+
+import org.apache.commons.geometry.core.collection.PointMap;
+import org.apache.commons.geometry.core.internal.AbstractBucketPointMap;
+import org.apache.commons.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.numbers.core.Precision;
+
+/** Internal {@link PointMap3D} implementation.
+ * @param <V> Map value type
+ */
+final class PointMap3DImpl<V>
+    extends AbstractBucketPointMap<Vector3D, V>
+    implements PointMap<Vector3D, V> {
+
+    /** Number of children per node. */
+    private static final int NODE_CHILD_COUNT = 8;
+
+    /** Max entries per node. This value was determined empirically was chosen 
to
+     * provide a balance between having a small number of entries in each node 
when
+     * searching and having a large number of samples to provide a good split 
point
+     * during insertion.
+     */
+    private static final int MAX_ENTRIES_PER_NODE = 32;
+
+    /** X negative octant flag. */
+    private static final int XNEG = 1 << 5;
+
+    /** X postive octant flag. */
+    private static final int XPOS = 1 << 4;
+
+    /** Y negative octant flag. */
+    private static final int YNEG = 1 << 3;
+
+    /** Y positive octant flag. */
+    private static final int YPOS = 1 << 2;
+
+    /** Z negative octant flag. */
+    private static final int ZNEG = 1 << 1;
+
+    /** Z positive octant flag. */
+    private static final int ZPOS = 1;
+
+    /** Octant location flags for child nodes. */
+    private static final int[] CHILD_LOCATIONS = {
+        XNEG | YNEG | ZNEG,
+        XNEG | YNEG | ZPOS,
+        XNEG | YPOS | ZNEG,
+        XNEG | YPOS | ZPOS,
+
+        XPOS | YNEG | ZNEG,
+        XPOS | YNEG | ZPOS,
+        XPOS | YPOS | ZNEG,
+        XPOS | YPOS | ZPOS
+    };
+
+    /** Construct a new instance using the given precision context to determine
+     * floating point equality.
+     * @param precision precision context
+     */
+    PointMap3DImpl(final Precision.DoubleEquivalence precision) {
+        super(MapNode3D::new,

Review comment:
       Lol! It's one of my favorite tricks at the moment :-)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to