Re: init
- From: Jon Harrop <usenet@xxxxxxxxxxxxxx>
- Date: Sat, 25 Feb 2006 17:43:54 +0000
bob@xxxxxxxxxxxxxx wrote:
why won't this work?
float boxcenter[3];
if (nodectr == 0)
boxcenter = {centerpt[0] + halfwidth/2.0, centerpt[1] + halfwidth/2.0,
centerpt[2] + halfwidth/2.0};
Because you're using the wrong language. Try OCaml:
let boxcenter = [|0.; 0.; 0.|] in
let boxcenter =
if nodectr<>0 then boxcenter else
[|centerpt.(0) +. halfwidth /. 2.;
centerpt.(1) +. halfwidth /. 2.;
centerpt.(2) +. halfwidth /. 2.|] in
or Mathematica:
boxcenter = {0,0,0}
If[nodectr==0, boxcenter={centerpt[[0]] + halfwidth/2.0,
centerpt[[1]] + halfwidth/2.0,
centerpt[[2]] + halfwidth/2.0}]
or C++ with a suitable library:
Vec<float, 3> boxcenter;
if (nodectr == 0)
boxcenter = Vec<float, 3>(centerpt[0] + halfwidth/2.0,
centerpt[1] + halfwidth/2.0,
centerpt[2] + halfwidth/2.0);
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html
.
- References:
- init
- From: bob
- init