コード例 #1
0
ファイル: HClusterGroup.cs プロジェクト: AlexDima17/paneling
        public static double distance(HCluster clusterA, HCluster clusterB)
        {
            double dist = Math.Pow(clusterA.meanVector.X - clusterB.meanVector.X, 2)
                          + Math.Pow(clusterA.meanVector.Y - clusterB.meanVector.Y, 2)
                          + Math.Pow(clusterA.meanVector.Z - clusterB.meanVector.Z, 2);

            return(Math.Sqrt(dist));
        }
コード例 #2
0
ファイル: HCluster.cs プロジェクト: AlexDima17/paneling
 //when clusters are merged, find mean vector of the two before "destoying" the previous cluster
 //no need to run through all inputs again
 internal void UpdateMean(HCluster hCluster)
 {
     meanVector = new Vector3d((meanVector.X + hCluster.meanVector.X) / 2,
                               (meanVector.Y + hCluster.meanVector.Y) / 2,
                               (meanVector.Z + hCluster.meanVector.Z) / 2);
 }
コード例 #3
0
ファイル: HCluster.cs プロジェクト: AlexDima17/paneling
 //method used when adding inputs of one cluster to another, to merge them
 public void AddInputs(HCluster clusterToMerge)
 {
     assignedInputs.AddRange(clusterToMerge.assignedInputs);
     assignedMeshes.AddRange(clusterToMerge.assignedMeshes);
 }