changeset 31794:17d568574e1c stable

isosurface: Avoid integer saturation with many vertices (bug #63704). * scripts/plot/draw/private/__marching_cube__.m (init_mc): Cast edge_table from uint16 to double precision floating point numbers to avoid integer saturation with many vertices.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 30 Jan 2023 18:30:33 +0100
parents 30b6a8be7128
children 7860fcc69082 8b869c5d6ce8
files scripts/plot/draw/private/__marching_cube__.m
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/private/__marching_cube__.m	Thu Dec 08 13:57:18 2022 -0500
+++ b/scripts/plot/draw/private/__marching_cube__.m	Mon Jan 30 18:30:33 2023 +0100
@@ -239,7 +239,7 @@
 
 function [edge_table, tri_table] = init_mc ()
 
-  edge_table = [
+  edge_table = double ([
     0x0000, 0x0109, 0x0203, 0x030a, 0x0406, 0x050f, 0x0605, 0x070c, ...
     0x080c, 0x0905, 0x0a0f, 0x0b06, 0x0c0a, 0x0d03, 0x0e09, 0x0f00, ...
     0x0190, 0x0099, 0x0393, 0x029a, 0x0596, 0x049f, 0x0795, 0x069c, ...
@@ -271,7 +271,7 @@
     0x0e90, 0x0f99, 0x0c93, 0x0d9a, 0x0a96, 0x0b9f, 0x0895, 0x099c, ...
     0x069c, 0x0795, 0x049f, 0x0596, 0x029a, 0x0393, 0x0099, 0x0190, ...
     0x0f00, 0x0e09, 0x0d03, 0x0c0a, 0x0b06, 0x0a0f, 0x0905, 0x080c, ...
-    0x070c, 0x0605, 0x050f, 0x0406, 0x030a, 0x0203, 0x0109, 0x0000 ];
+    0x070c, 0x0605, 0x050f, 0x0406, 0x030a, 0x0203, 0x0109, 0x0000 ]);
 
   tri_table = [
   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1;