-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multiply3d subtract3d maximum3d average3d (#14)
- Loading branch information
Showing
10 changed files
with
573 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
function Average() { | ||
import {MergedLayer3d} from "../layer/abstract/MergedLayer3d"; | ||
|
||
function Average(layerList) { | ||
|
||
let operatorType = "average"; | ||
|
||
validate(layerList); | ||
|
||
return createMergedLayer(layerList); | ||
|
||
function validate(layerList) { | ||
|
||
let depth; | ||
|
||
if (layerList.length > 0) { | ||
depth = layerList[0].layerDimension; | ||
} else { | ||
console.error("Merge Layer missing elements."); | ||
} | ||
|
||
for (let i = 0; i < layerList.length; i++) { | ||
|
||
if (layerList[i].layerDimension !== depth) { | ||
console.error("Can not add layer with different depth."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
function createMergedLayer(layerList) { | ||
|
||
if (layerList[0].layerDimension === 1) { | ||
|
||
} else if (layerList[0].layerDimension === 2) { | ||
|
||
} else if (layerList[0].layerDimension === 3) { | ||
|
||
return new MergedLayer3d({ | ||
operator: operatorType, | ||
mergedElements: layerList | ||
}); | ||
|
||
} else { | ||
console.error("Do not support layer add operation more than 4 dimension."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
export { Average }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
function Maximum() { | ||
import {MergedLayer3d} from "../layer/abstract/MergedLayer3d"; | ||
|
||
function Maximum(layerList) { | ||
|
||
let operatorType = "maximum"; | ||
|
||
validate(layerList); | ||
|
||
return createMergedLayer(layerList); | ||
|
||
function validate(layerList) { | ||
|
||
let depth; | ||
|
||
if (layerList.length > 0) { | ||
depth = layerList[0].layerDimension; | ||
} else { | ||
console.error("Merge Layer missing elements."); | ||
} | ||
|
||
for (let i = 0; i < layerList.length; i++) { | ||
|
||
if (layerList[i].layerDimension !== depth) { | ||
console.error("Can not add layer with different depth."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
function createMergedLayer(layerList) { | ||
|
||
if (layerList[0].layerDimension === 1) { | ||
|
||
} else if (layerList[0].layerDimension === 2) { | ||
|
||
} else if (layerList[0].layerDimension === 3) { | ||
|
||
return new MergedLayer3d({ | ||
operator: operatorType, | ||
mergedElements: layerList | ||
}); | ||
|
||
} else { | ||
console.error("Do not support layer add operation more than 4 dimension."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
export { Maximum }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
function Multiply() { | ||
import {MergedLayer3d} from "../layer/abstract/MergedLayer3d"; | ||
|
||
function Multiply(layerList) { | ||
|
||
let operatorType = "multiply"; | ||
|
||
validate(layerList); | ||
|
||
return createMergedLayer(layerList); | ||
|
||
function validate(layerList) { | ||
|
||
let depth; | ||
|
||
if (layerList.length > 0) { | ||
depth = layerList[0].layerDimension; | ||
} else { | ||
console.error("Merge Layer missing elements."); | ||
} | ||
|
||
for (let i = 0; i < layerList.length; i++) { | ||
|
||
if (layerList[i].layerDimension !== depth) { | ||
console.error("Can not add layer with different depth."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
function createMergedLayer(layerList) { | ||
|
||
if (layerList[0].layerDimension === 1) { | ||
|
||
} else if (layerList[0].layerDimension === 2) { | ||
|
||
} else if (layerList[0].layerDimension === 3) { | ||
|
||
return new MergedLayer3d({ | ||
operator: operatorType, | ||
mergedElements: layerList | ||
}); | ||
|
||
} else { | ||
console.error("Do not support layer add operation more than 4 dimension."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
export { Multiply }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,52 @@ | ||
function Subtract() { | ||
import {MergedLayer3d} from "../layer/abstract/MergedLayer3d"; | ||
|
||
function Subtract(layerList) { | ||
|
||
let operatorType = "subtract"; | ||
|
||
validate(layerList); | ||
|
||
return createMergedLayer(layerList); | ||
|
||
function validate(layerList) { | ||
|
||
let depth; | ||
|
||
if (layerList.length > 0) { | ||
depth = layerList[0].layerDimension; | ||
} else { | ||
console.error("Merge Layer missing elements."); | ||
} | ||
|
||
for (let i = 0; i < layerList.length; i++) { | ||
|
||
if (layerList[i].layerDimension !== depth) { | ||
console.error("Can not add layer with different depth."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
function createMergedLayer(layerList) { | ||
|
||
if (layerList[0].layerDimension === 1) { | ||
|
||
} else if (layerList[0].layerDimension === 2) { | ||
|
||
} else if (layerList[0].layerDimension === 3) { | ||
|
||
return new MergedLayer3d({ | ||
operator: operatorType, | ||
mergedElements: layerList | ||
}); | ||
|
||
} else { | ||
console.error("Do not support layer add operation more than 4 dimension."); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
export { Subtract }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.