Re: can't translate 3D model to 0,0,0
- To: mathgroup at smc.vnet.net
- Subject: [mg88446] Re: can't translate 3D model to 0,0,0
- From: tommcd <TCMcDermott at gmail.com>
- Date: Mon, 5 May 2008 06:16:16 -0400 (EDT)
- References: <fvhe4g$3v9$1@smc.vnet.net>
On May 3, 11:17 am, will parr <willpower... at hotmail.com> wrote:
> Dear Math Forum,
>
> I have a problem with translating some 3D models to 0,0,0. I have been using the following code:
>
> ma = Mean@a; ac = # + ({0, 0, 0} - ma) & /@ a;
>
> where "a" is a 3D model made up of many 3D coordinates. However, this code does not work - in that the new centroid (mean) of the model is not at 0,0,0. can anyone suggest an alternative method?
>
> best wishes,
>
> Will
If a is a list of coordinates the code you posted seems fine:
a = {{a11, a12, a13}, {a21, a22, a23}, {a31, a32, a33}, {a41,
a42,a43}};
ma = Mean@a;
ac = # + ({0, 0, 0} - ma) & /@ a;
In[4]:= Mean@ac
Out[4]= {0, 0, 0} .... as expected