Пример #1
0
 /// <summary>
 /// split a node by splatter
 /// </summary>
 /// <param name="thisRoot"></param>
 private void SplitBySplatter(Node thisRoot, ref BVTree left, ref BVTree right)
 {
     AtomInfo [] leftAtoms  = null;
     AtomInfo [] rightAtoms = null;
     SplitNodeBySplatter(thisRoot.AtomList, ref leftAtoms, ref rightAtoms);
     left.Root  = new Node(leftAtoms);
     right.Root = new Node(rightAtoms);
 }
Пример #2
0
        /// <summary>
        /// update the tree based on translation vector
        /// </summary>
        /// <param name="transVector"></param>
        /// <returns></returns>
        public BVTree UpdateBVTree(double [] transVector)
        {
            BVTree updatedTree = new BVTree();

            double [] kDopTransVector = AppSettings.kVector * transVector;
            // update the tree
            UpdateTreeNodes(updatedTree, kDopTransVector);
            return(updatedTree);
        }
Пример #3
0
        /// <summary>
        /// split a list of atoms by Amplitude
        /// </summary>
        /// <param name="thisRoot"></param>
        private void SplitByAmplitude(Node thisRoot, ref BVTree left, ref BVTree right)
        {
            AtomInfo [] leftAtoms  = null;
            AtomInfo [] rightAtoms = null;
            int         axisNum    = FindSplitterAxis(thisRoot);

            SplitNodeByAmplitude(thisRoot.AtomList, axisNum, ref leftAtoms, ref rightAtoms);
            left.Root  = new Node(leftAtoms);
            right.Root = new Node(rightAtoms);
        }
Пример #4
0
        /// <summary>
        /// recursively build the binary tree by Amplitude
        /// </summary>
        /// <param name="root"></param>
        private void BuildBVTreeByAmplitude(Node root)
        {
            if (root.AtomList.Length <= leafAtomNumber)
            {
                return;
            }

            leftBranch  = new BVTree();
            rightBranch = new BVTree();
            SplitByAmplitude(root, ref leftBranch, ref rightBranch);
            BuildBVTreeByAmplitude(leftBranch.Root);
            BuildBVTreeByAmplitude(rightBranch.Root);
        }
Пример #5
0
 /// <summary>
 /// update the tree to another tree with exactly same structure
 /// using bottom-up
 /// </summary>
 /// <param name="extBvTree"></param>
 private void UpdateTreeNodes(BVTree extBvTree, double[] kDopTransVector)
 {
     if (this.root.AtomList.Length <= leafAtomNumber)
     {
         extBvTree.root = new Node(this.root);
         extBvTree.root.UpdateLeafNode(kDopTransVector);
         return;
     }
     extBvTree.leftBranch = new BVTree();
     this.leftBranch.UpdateTreeNodes(extBvTree.leftBranch, kDopTransVector);
     extBvTree.rightBranch = new BVTree();
     this.rightBranch.UpdateTreeNodes(extBvTree.rightBranch, kDopTransVector);
     // combine two child nodes
     extBvTree.Root = new Node();
     extBvTree.root.Merge2Nodes(extBvTree.leftBranch.root, extBvTree.rightBranch.root);
 }
Пример #6
0
 /* Choice of a plane orthogonal to the x-, y- or z-axis
  * based upon one of the following objective functions
  * Splatter: Projects each point onto each of the three coordinate axes and
  *			calculate the variance of each of the resulting distributions.
  *			Choose the axis yielding the largest variance.
  *			Computation Time: O(|Sv|), linear time
  * Amplitude: Choose the axis along which the k-dop, bounding box b(Sv), is longest
  *			Computation Time: 3 subtractions and 2 comparisons
  * Min Sum: Choose the axis that minimizes the sum of the volumes
  *			of the two resulting children.
  *			Computation Time: O(k|Sv|) + O(klogk)
  * Min Max: Choose the axis that minimizes
  *			the larger of the volumes of the two resulting children.
  * ("Min Sum" and "Min Max" not implemented yet)
  * */
 #region split
 #region splatter
 /// <summary>
 /// recursively build the binary tree
 /// by splatter
 /// </summary>
 /// <param name="root"></param>
 private void BuildBVTreeBySplatter(Node root)
 {
     if (root == null)
     {
         return;
     }
     if (root.AtomList.Length <= leafAtomNumber)
     {
         return;
     }
     leftBranch  = new BVTree();
     rightBranch = new BVTree();
     SplitBySplatter(root, ref leftBranch, ref rightBranch);
     leftBranch.BuildBVTreeBySplatter(leftBranch.Root);
     rightBranch.BuildBVTreeBySplatter(rightBranch.Root);
 }
Пример #7
0
 public BVTree(BVTree extTree)
 {
     root        = extTree.Root;
     rightBranch = extTree.RightBranch;
     leftBranch  = extTree.LeftBranch;
 }