From 6b6422de7ec95c30600ae60cd371ef2681d8b726 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sun, 23 Apr 2023 10:31:13 +0200 Subject: [PATCH] Add size calculation example. --- sandbox/embed_selfhost_calculate.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sandbox/embed_selfhost_calculate.html b/sandbox/embed_selfhost_calculate.html index 98d0652..ee5dcba 100644 --- a/sandbox/embed_selfhost_calculate.html +++ b/sandbox/embed_selfhost_calculate.html @@ -23,9 +23,15 @@ function OnModelLoaded (model) { let calculationDiv = document.getElementById ('calculation_result'); + let boundingBox = OV.GetBoundingBox (model); calculationDiv.innerHTML = 'Surface area: ' + OV.CalculateSurfaceArea (model).toFixed (2) + '
' + - 'Volume: ' + OV.CalculateVolume (model).toFixed (2) + '
'; + 'Volume: ' + OV.CalculateVolume (model).toFixed (2) + '
' + + 'Size: (' + + (boundingBox.max.x - boundingBox.min.x) + ', ' + + (boundingBox.max.y - boundingBox.min.y) + ', ' + + (boundingBox.max.z - boundingBox.min.z) + + ')
'; } window.addEventListener ('load', () => {