star-3dut

Generate meshes of simple geometric shapes
git clone git://git.meso-star.fr/star-3dut.git
Log | Files | Refs | README | LICENSE

commit 0c1ee97c60de54bc215ae7fbe028b3e5840904f7
parent b192356b48a4ee7bab9b6e21bc4316dfc0f8c9e9
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue, 10 Oct 2017 11:49:14 +0200

BugFix: providing a legal NULL arg caused a crash.

Diffstat:
Msrc/s3dut_sphere.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/s3dut_sphere.c b/src/s3dut_sphere.c @@ -224,7 +224,7 @@ sphere_accum_counts const int close_bottom = bottom_truncated && (close_ends & S3DUT_END_BOTTOM); const unsigned nb_closed_ends = (close_top ? 1 : 0) + (close_bottom ? 1 : 0); const unsigned nb_pole_vrtx = nb_closed_ends + (2 - nb_truncated); - ASSERT(z_range && nrings && ntris && nverts); + ASSERT(nrings && ntris && nverts); *nrings = nstacks - 1 + nb_truncated;; *nverts += nslices*(*nrings) /* #contour verts*/ + nb_pole_vrtx; /*polar verts*/ *ntris += 2 * nslices * (*nrings -1) /* #contour tris */ @@ -363,10 +363,10 @@ s3dut_create_thick_truncated_sphere if (bottom_truncated && (z_range[0] <= -internal_radius)) { close_ends |= S3DUT_END_BOTTOM; /* close the external sphere's bottom end */ } - z_internal_range[0] - = (bottom_truncated && !close_bottom) ? z_range[0] : z_range[0] + thickness; - z_internal_range[1] - = (top_truncated && !close_top) ? z_range[1] : z_range[1] - thickness; + z_internal_range[0] = (bottom_truncated && !close_bottom) + ? z_range[0] : (z_range ? z_range[0] : -radius) + thickness; + z_internal_range[1] = (top_truncated && !close_top) ? + z_range[1] : (z_range ? z_range[1] : +radius) - thickness; sphere_accum_counts(radius, nslices, nstacks, z_range, close_ends, &external_nrings, &ntris, &nverts); sphere_accum_counts(radius-thickness, nslices, nstacks, z_internal_range,