Re: Maths problem (barycentric coordinates)
So barycoords for a triangle works well and I believe there are tons of references on the web for this. Barycoordinates for polygons is a bit more problematic because they are no longer linear but rather polynomials and thus harder to calculate. I'd stick with triangles and then all those web references should work well. Is your problem calculating them from points? Basically this is a great guide: http://en.wikipedia.org/wiki/Barycentric_coordinate_system -ben On Wed, Jul 17, 2013 at 11:38 AM, wrote: > Hi, I have spent days on this and I cant work it out > > I have a selection of points (not on a flat plane) and I have a test > position. > It returns an array that represents the weighting, related to the proximity > to the other points. > > I want to have it so that when the test position is directly at a point, the > value for that point in the array = 1 > and the rest will be zero > as the test point moves around the area it interpolates these values, but > they always add up to 1 > > It sounds really easy, but I’ve been literally* tearing my hair out over > this for days. > > Ive managed to get barycentric interpolation working for a flat plane, and > only 3 points, but I need it to accept multiple points in 3d space. > > Please help. I’m going bonkers over this > > Paul > > *(not really literally) -- Best regards, Ben Houston Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom http://Exocortex.com - Passionate CG Software Professionals.
Re: Maths problem (barycentric coordinates)
If you can chew through the greek notation this is helpful. http://en.wikipedia.org/wiki/Inverse_distance_weighting On Wed, Jul 17, 2013 at 11:38 AM, wrote: > Hi, I have spent days on this and I cant work it out > > I have a selection of points (not on a flat plane) and I have a test > position. > It returns an array that represents the weighting, related to the > proximity to the other points. > > I want to have it so that when the test position is directly at a point, > the value for that point in the array = 1 > and the rest will be zero > as the test point moves around the area it interpolates these values, > but they always add up to 1 > > It sounds really easy, but I’ve been literally* tearing my hair out over > this for days. > > Ive managed to get barycentric interpolation working for a flat plane, > and only 3 points, but I need it to accept multiple points in 3d space. > > Please help. I’m going bonkers over this > > Paul > > *(not really literally) >
Re: Maths problem (barycentric coordinates)
I have been googling all I can find trying to understand the maths notation but its not my forte and I've not found anything that does exactly what I want. I was hoping someone cleverer than i might take pity on me and provide an idiot proof explanation. On 17 Jul 2013, at 17:07, David Barosin wrote: > If you can chew through the greek notation this is helpful. > http://en.wikipedia.org/wiki/Inverse_distance_weighting > > > > > On Wed, Jul 17, 2013 at 11:38 AM, wrote: >> Hi, I have spent days on this and I cant work it out >> >> I have a selection of points (not on a flat plane) and I have a test >> position. >> It returns an array that represents the weighting, related to the proximity >> to the other points. >> >> I want to have it so that when the test position is directly at a point, the >> value for that point in the array = 1 >> and the rest will be zero >> as the test point moves around the area it interpolates these values, but >> they always add up to 1 >> >> It sounds really easy, but I’ve been literally* tearing my hair out over >> this for days. >> >> Ive managed to get barycentric interpolation working for a flat plane, and >> only 3 points, but I need it to accept multiple points in 3d space. >> >> Please help. I’m going bonkers over this >> >> Paul >> >> *(not really literally) >
Re: Maths problem (barycentric coordinates)
BTW here is our code for calculating barycoordinates from points and creating points from barycoordinates: template class Triangle3 { public: Vec3 a; Vec3 b; Vec3 c; Matrix44 getPointToBarycoordMatrix() const; Matrix44 getBarycoordToPointMatrix() const; }; template inline Matrix44 Triangle3::getPointToBarycoordMatrix() const { M44x pointToBarycoordMatrix; bool success = inverseSafe( pointToBarycoordMatrix, getBarycoordToPointMatrix() ); if( ! success ) { T oneThird = ((T)1.0)/((T)3.0); //Vec3 center = ( a + b + c ) * oneThird; return Matrix44( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, oneThird, oneThird, oneThird, 0); } return pointToBarycoordMatrix; } template inline Matrix44 Triangle3::getBarycoordToPointMatrix() const { Vec3 n = normal(); return Matrix44( a[0], a[1], a[2], 1, b[0], b[1], b[2], 1, c[0], c[1], c[2], 1, n[0], n[1], n[2], 0); } And this you just multiple your point by the "pointToBarycoordMatrix" matrix to get barycoords. And if you have barycoordinates, multiply it by "getBarycoordToPointMatrix()" to get your point. We are using 4 coordinate barycoordinates where the fourth element is the distance from the triangle plane in the normal direction. Just set it to zero and you should be fine. The above can be converted to Softimage Matrix types pretty easily. Probably could be added to the Softimage SDK as well if it isn't already there. Best regards, -ben On Wed, Jul 17, 2013 at 12:04 PM, Ben Houston wrote: > So barycoords for a triangle works well and I believe there are tons > of references on the web for this. Barycoordinates for polygons is a > bit more problematic because they are no longer linear but rather > polynomials and thus harder to calculate. I'd stick with triangles > and then all those web references should work well. > > Is your problem calculating them from points? > > Basically this is a great guide: > > http://en.wikipedia.org/wiki/Barycentric_coordinate_system > > -ben > > > On Wed, Jul 17, 2013 at 11:38 AM, wrote: >> Hi, I have spent days on this and I cant work it out >> >> I have a selection of points (not on a flat plane) and I have a test >> position. >> It returns an array that represents the weighting, related to the proximity >> to the other points. >> >> I want to have it so that when the test position is directly at a point, the >> value for that point in the array = 1 >> and the rest will be zero >> as the test point moves around the area it interpolates these values, but >> they always add up to 1 >> >> It sounds really easy, but I’ve been literally* tearing my hair out over >> this for days. >> >> Ive managed to get barycentric interpolation working for a flat plane, and >> only 3 points, but I need it to accept multiple points in 3d space. >> >> Please help. I’m going bonkers over this >> >> Paul >> >> *(not really literally) > > > > -- > Best regards, > Ben Houston > Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom > http://Exocortex.com - Passionate CG Software Professionals. -- Best regards, Ben Houston Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom http://Exocortex.com - Passionate CG Software Professionals.
Re: Maths problem (barycentric coordinates)
You can have a look at my blog post: http://alokgandhi.com/blog/2012/05/28/barycentric-coordinates-and-the-magic-of-locations/ On Wed, Jul 17, 2013 at 12:58 PM, Ben Houston wrote: > BTW here is our code for calculating barycoordinates from points and > creating points from barycoordinates: > > template > class Triangle3 { > public: > Vec3 a; > Vec3 b; > Vec3 c; > > Matrix44 getPointToBarycoordMatrix() const; > Matrix44 getBarycoordToPointMatrix() const; > }; > > template > inline Matrix44 Triangle3::getPointToBarycoordMatrix() const { > M44x pointToBarycoordMatrix; > bool success = inverseSafe( pointToBarycoordMatrix, > getBarycoordToPointMatrix() ); > if( ! success ) { > T oneThird = ((T)1.0)/((T)3.0); > //Vec3 center = ( a + b + c ) * oneThird; > return Matrix44( > 0, 0, 0, 0, > 0, 0, 0, 0, > 0, 0, 0, 0, > oneThird, oneThird, oneThird, 0); > } > return pointToBarycoordMatrix; > } > > template > inline Matrix44 Triangle3::getBarycoordToPointMatrix() const { > Vec3 n = normal(); > return Matrix44( > a[0], a[1], a[2], 1, > b[0], b[1], b[2], 1, > c[0], c[1], c[2], 1, > n[0], n[1], n[2], 0); > } > > And this you just multiple your point by the "pointToBarycoordMatrix" > matrix to get barycoords. And if you have barycoordinates, multiply > it by "getBarycoordToPointMatrix()" to get your point. > > We are using 4 coordinate barycoordinates where the fourth element is > the distance from the triangle plane in the normal direction. Just > set it to zero and you should be fine. The above can be converted to > Softimage Matrix types pretty easily. Probably could be added to the > Softimage SDK as well if it isn't already there. > > Best regards, > -ben > > > On Wed, Jul 17, 2013 at 12:04 PM, Ben Houston wrote: > > So barycoords for a triangle works well and I believe there are tons > > of references on the web for this. Barycoordinates for polygons is a > > bit more problematic because they are no longer linear but rather > > polynomials and thus harder to calculate. I'd stick with triangles > > and then all those web references should work well. > > > > Is your problem calculating them from points? > > > > Basically this is a great guide: > > > > http://en.wikipedia.org/wiki/Barycentric_coordinate_system > > > > -ben > > > > > > On Wed, Jul 17, 2013 at 11:38 AM, wrote: > >> Hi, I have spent days on this and I cant work it out > >> > >> I have a selection of points (not on a flat plane) and I have a test > >> position. > >> It returns an array that represents the weighting, related to the > proximity > >> to the other points. > >> > >> I want to have it so that when the test position is directly at a > point, the > >> value for that point in the array = 1 > >> and the rest will be zero > >> as the test point moves around the area it interpolates these values, > but > >> they always add up to 1 > >> > >> It sounds really easy, but I’ve been literally* tearing my hair out over > >> this for days. > >> > >> Ive managed to get barycentric interpolation working for a flat plane, > and > >> only 3 points, but I need it to accept multiple points in 3d space. > >> > >> Please help. I’m going bonkers over this > >> > >> Paul > >> > >> *(not really literally) > > > > > > > > -- > > Best regards, > > Ben Houston > > Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom > > http://Exocortex.com - Passionate CG Software Professionals. > > > > -- > Best regards, > Ben Houston > Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom > http://Exocortex.com - Passionate CG Software Professionals. > > --
RE: Maths problem (barycentric coordinates)
Translated from the Greek: 1. Calculate the distance from the test position to each of your selected points. 2. If one of the distances is 0, stop. The corresponding coordinate is 1, the others are 0. 3. Otherwise for each of the distances, calculate 1/distance, or 1/distance^2, or 1/distance^3, or ... . 4. Normalize the values above. In other words, get their sum and for each value calculate value/sum. Ta da! gray From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Paul Sent: Wednesday, July 17, 2013 12:52 PM To: softimage@listproc.autodesk.com Subject: Re: Maths problem (barycentric coordinates) I have been googling all I can find trying to understand the maths notation but its not my forte and I've not found anything that does exactly what I want. I was hoping someone cleverer than i might take pity on me and provide an idiot proof explanation. On 17 Jul 2013, at 17:07, David Barosin mailto:dbaro...@gmail.com>> wrote: If you can chew through the greek notation this is helpful. http://en.wikipedia.org/wiki/Inverse_distance_weighting On Wed, Jul 17, 2013 at 11:38 AM, mailto:p...@bustykelp.com>> wrote: Hi, I have spent days on this and I cant work it out I have a selection of points (not on a flat plane) and I have a test position. It returns an array that represents the weighting, related to the proximity to the other points. I want to have it so that when the test position is directly at a point, the value for that point in the array = 1 and the rest will be zero as the test point moves around the area it interpolates these values, but they always add up to 1 It sounds really easy, but I’ve been literally* tearing my hair out over this for days. Ive managed to get barycentric interpolation working for a flat plane, and only 3 points, but I need it to accept multiple points in 3d space. Please help. I’m going bonkers over this Paul *(not really literally) <>
Re: Maths problem (barycentric coordinates)
something we recorded last year while I was in NY: https://vimeo.com/44951318 maybe this helps :) Cheers Vladimir On Wed, Jul 17, 2013 at 2:05 PM, Vincent Ullmann < vincent.ullm...@googlemail.com> wrote: > Quote Paul: > > { > Ive managed to get barycentric interpolation working for a flat plane, > and only 3 points, but I need it to accept multiple points in 3d space. > } > > Not sure if this helps, but some time ago i made a ICE-Compound for > calulating barycentric-Coordinates, based on 3 3D-Vectors. > Dont know if my formula was correct ;-) > > > Am 17.07.2013 19:47, schrieb Alok Gandhi: > > You can have a look at my blog post: > > http://alokgandhi.com/blog/2012/05/28/barycentric-coordinates-and-the-magic-of-locations/ > > > On Wed, Jul 17, 2013 at 12:58 PM, Ben Houston wrote: > >> BTW here is our code for calculating barycoordinates from points and >> creating points from barycoordinates: >> >> template >> class Triangle3 { >> public: >> Vec3 a; >> Vec3 b; >> Vec3 c; >> >> Matrix44 getPointToBarycoordMatrix() const; >> Matrix44 getBarycoordToPointMatrix() const; >> }; >> >> template >> inline Matrix44 Triangle3::getPointToBarycoordMatrix() const { >> M44x pointToBarycoordMatrix; >> bool success = inverseSafe( pointToBarycoordMatrix, >> getBarycoordToPointMatrix() ); >> if( ! success ) { >> T oneThird = ((T)1.0)/((T)3.0); >> //Vec3 center = ( a + b + c ) * oneThird; >> return Matrix44( >> 0, 0, 0, 0, >> 0, 0, 0, 0, >> 0, 0, 0, 0, >> oneThird, oneThird, oneThird, 0); >> } >> return pointToBarycoordMatrix; >> } >> >> template >> inline Matrix44 Triangle3::getBarycoordToPointMatrix() const { >> Vec3 n = normal(); >> return Matrix44( >> a[0], a[1], a[2], 1, >> b[0], b[1], b[2], 1, >> c[0], c[1], c[2], 1, >> n[0], n[1], n[2], 0); >> } >> >> And this you just multiple your point by the "pointToBarycoordMatrix" >> matrix to get barycoords. And if you have barycoordinates, multiply >> it by "getBarycoordToPointMatrix()" to get your point. >> >> We are using 4 coordinate barycoordinates where the fourth element is >> the distance from the triangle plane in the normal direction. Just >> set it to zero and you should be fine. The above can be converted to >> Softimage Matrix types pretty easily. Probably could be added to the >> Softimage SDK as well if it isn't already there. >> >> Best regards, >> -ben >> >> >> On Wed, Jul 17, 2013 at 12:04 PM, Ben Houston wrote: >> > So barycoords for a triangle works well and I believe there are tons >> > of references on the web for this. Barycoordinates for polygons is a >> > bit more problematic because they are no longer linear but rather >> > polynomials and thus harder to calculate. I'd stick with triangles >> > and then all those web references should work well. >> > >> > Is your problem calculating them from points? >> > >> > Basically this is a great guide: >> > >> > http://en.wikipedia.org/wiki/Barycentric_coordinate_system >> > >> > -ben >> > >> > >> > On Wed, Jul 17, 2013 at 11:38 AM, wrote: >> >> Hi, I have spent days on this and I cant work it out >> >> >> >> I have a selection of points (not on a flat plane) and I have a test >> >> position. >> >> It returns an array that represents the weighting, related to the >> proximity >> >> to the other points. >> >> >> >> I want to have it so that when the test position is directly at a >> point, the >> >> value for that point in the array = 1 >> >> and the rest will be zero >> >> as the test point moves around the area it interpolates these values, >> but >> >> they always add up to 1 >> >> >> >> It sounds really easy, but I’ve been literally* tearing my hair out >> over >> >> this for days. >> >> >> >> Ive managed to get barycentric interpolation working for a flat plane, >> and >> >> only 3 points, but I need it to accept multiple points in 3d space. >> >> >> >> Please help. I’m going bonkers over this >> >> >> >> Paul >> >> >> >> *(not really literally) >> > >> > >> > >> > -- >> > Best regards, >> > Ben Houston >> > Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom >> > http://Exocortex.com - Passionate CG Software Professionals. >> >> >> >> -- >> Best regards, >> Ben Houston >> Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom >> http://Exocortex.com - Passionate CG Software Professionals. >> >> > > > -- > > >
Re: Maths problem (barycentric coordinates)
Thanks for all the replies. It's much appreciated. I'll grind through them tomorrow at work. On 17 Jul 2013, at 19:26, Vladimir Jankijevic wrote: > something we recorded last year while I was in NY: https://vimeo.com/44951318 > maybe this helps :) > > Cheers > Vladimir > > > On Wed, Jul 17, 2013 at 2:05 PM, Vincent Ullmann > wrote: > Quote Paul: > > { > Ive managed to get barycentric interpolation working for a flat plane, > and only 3 points, but I need it to accept multiple points in 3d space. > } > > Not sure if this helps, but some time ago i made a ICE-Compound for > calulating barycentric-Coordinates, based on 3 3D-Vectors. > Dont know if my formula was correct ;-) > > > Am 17.07.2013 19:47, schrieb Alok Gandhi: >> You can have a look at my blog post: >> http://alokgandhi.com/blog/2012/05/28/barycentric-coordinates-and-the-magic-of-locations/ >> >> >> On Wed, Jul 17, 2013 at 12:58 PM, Ben Houston wrote: >> BTW here is our code for calculating barycoordinates from points and >> creating points from barycoordinates: >> >> template >> class Triangle3 { >> public: >> Vec3 a; >> Vec3 b; >> Vec3 c; >> >> Matrix44 getPointToBarycoordMatrix() const; >> Matrix44 getBarycoordToPointMatrix() const; >> }; >> >> template >> inline Matrix44 Triangle3::getPointToBarycoordMatrix() const { >> M44x pointToBarycoordMatrix; >> bool success = inverseSafe( pointToBarycoordMatrix, >> getBarycoordToPointMatrix() ); >> if( ! success ) { >> T oneThird = ((T)1.0)/((T)3.0); >> //Vec3 center = ( a + b + c ) * oneThird; >> return Matrix44( >> 0, 0, 0, 0, >> 0, 0, 0, 0, >> 0, 0, 0, 0, >> oneThird, oneThird, oneThird, 0); >> } >> return pointToBarycoordMatrix; >> } >> >> template >> inline Matrix44 Triangle3::getBarycoordToPointMatrix() const { >> Vec3 n = normal(); >> return Matrix44( >> a[0], a[1], a[2], 1, >> b[0], b[1], b[2], 1, >> c[0], c[1], c[2], 1, >> n[0], n[1], n[2], 0); >> } >> >> And this you just multiple your point by the "pointToBarycoordMatrix" >> matrix to get barycoords. And if you have barycoordinates, multiply >> it by "getBarycoordToPointMatrix()" to get your point. >> >> We are using 4 coordinate barycoordinates where the fourth element is >> the distance from the triangle plane in the normal direction. Just >> set it to zero and you should be fine. The above can be converted to >> Softimage Matrix types pretty easily. Probably could be added to the >> Softimage SDK as well if it isn't already there. >> >> Best regards, >> -ben >> >> >> On Wed, Jul 17, 2013 at 12:04 PM, Ben Houston wrote: >> > So barycoords for a triangle works well and I believe there are tons >> > of references on the web for this. Barycoordinates for polygons is a >> > bit more problematic because they are no longer linear but rather >> > polynomials and thus harder to calculate. I'd stick with triangles >> > and then all those web references should work well. >> > >> > Is your problem calculating them from points? >> > >> > Basically this is a great guide: >> > >> > http://en.wikipedia.org/wiki/Barycentric_coordinate_system >> > >> > -ben >> > >> > >> > On Wed, Jul 17, 2013 at 11:38 AM, wrote: >> >> Hi, I have spent days on this and I cant work it out >> >> >> >> I have a selection of points (not on a flat plane) and I have a test >> >> position. >> >> It returns an array that represents the weighting, related to the >> >> proximity >> >> to the other points. >> >> >> >> I want to have it so that when the test position is directly at a point, >> >> the >> >> value for that point in the array = 1 >> >> and the rest will be zero >> >> as the test point moves around the area it interpolates these values, but >> >> they always add up to 1 >> >> >> >> It sounds really easy, but I’ve been literally* tearing my hair out over >> >> this for days. >> >> >> >> Ive managed to get barycentric interpolation working for a flat plane, and >> >> only 3 points, but I need it to accept multiple points in 3d space. >> >> >> >> Please help. I’m going bonkers over this >> >> >> >> Paul >> >> >> >> *(not really literally) >> > >> > >> > >> > -- >> > Best regards, >> > Ben Houston >> > Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom >> > http://Exocortex.com - Passionate CG Software Professionals. >> >> >> >> -- >> Best regards, >> Ben Houston >> Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom >> http://Exocortex.com - Passionate CG Software Professionals. >> >> >> >> >> -- >> > >
Re: Maths problem (barycentric coordinates)
Alok since you bring it up I am reminded to belatedly thank you for this article - it's a fantastic read, and your blog is a personal favorite. Sent from iGadget On Jul 17, 2013, at 10:47 AM, Alok Gandhi wrote: > You can have a look at my blog post: > http://alokgandhi.com/blog/2012/05/28/barycentric-coordinates-and-the-magic-of-locations/ > > > On Wed, Jul 17, 2013 at 12:58 PM, Ben Houston wrote: >> BTW here is our code for calculating barycoordinates from points and >> creating points from barycoordinates: >> >> template >> class Triangle3 { >> public: >> Vec3 a; >> Vec3 b; >> Vec3 c; >> >> Matrix44 getPointToBarycoordMatrix() const; >> Matrix44 getBarycoordToPointMatrix() const; >> }; >> >> template >> inline Matrix44 Triangle3::getPointToBarycoordMatrix() const { >> M44x pointToBarycoordMatrix; >> bool success = inverseSafe( pointToBarycoordMatrix, >> getBarycoordToPointMatrix() ); >> if( ! success ) { >> T oneThird = ((T)1.0)/((T)3.0); >> //Vec3 center = ( a + b + c ) * oneThird; >> return Matrix44( >> 0, 0, 0, 0, >> 0, 0, 0, 0, >> 0, 0, 0, 0, >> oneThird, oneThird, oneThird, 0); >> } >> return pointToBarycoordMatrix; >> } >> >> template >> inline Matrix44 Triangle3::getBarycoordToPointMatrix() const { >> Vec3 n = normal(); >> return Matrix44( >> a[0], a[1], a[2], 1, >> b[0], b[1], b[2], 1, >> c[0], c[1], c[2], 1, >> n[0], n[1], n[2], 0); >> } >> >> And this you just multiple your point by the "pointToBarycoordMatrix" >> matrix to get barycoords. And if you have barycoordinates, multiply >> it by "getBarycoordToPointMatrix()" to get your point. >> >> We are using 4 coordinate barycoordinates where the fourth element is >> the distance from the triangle plane in the normal direction. Just >> set it to zero and you should be fine. The above can be converted to >> Softimage Matrix types pretty easily. Probably could be added to the >> Softimage SDK as well if it isn't already there. >> >> Best regards, >> -ben >> >> >> On Wed, Jul 17, 2013 at 12:04 PM, Ben Houston wrote: >> > So barycoords for a triangle works well and I believe there are tons >> > of references on the web for this. Barycoordinates for polygons is a >> > bit more problematic because they are no longer linear but rather >> > polynomials and thus harder to calculate. I'd stick with triangles >> > and then all those web references should work well. >> > >> > Is your problem calculating them from points? >> > >> > Basically this is a great guide: >> > >> > http://en.wikipedia.org/wiki/Barycentric_coordinate_system >> > >> > -ben >> > >> > >> > On Wed, Jul 17, 2013 at 11:38 AM, wrote: >> >> Hi, I have spent days on this and I cant work it out >> >> >> >> I have a selection of points (not on a flat plane) and I have a test >> >> position. >> >> It returns an array that represents the weighting, related to the >> >> proximity >> >> to the other points. >> >> >> >> I want to have it so that when the test position is directly at a point, >> >> the >> >> value for that point in the array = 1 >> >> and the rest will be zero >> >> as the test point moves around the area it interpolates these values, but >> >> they always add up to 1 >> >> >> >> It sounds really easy, but I’ve been literally* tearing my hair out over >> >> this for days. >> >> >> >> Ive managed to get barycentric interpolation working for a flat plane, and >> >> only 3 points, but I need it to accept multiple points in 3d space. >> >> >> >> Please help. I’m going bonkers over this >> >> >> >> Paul >> >> >> >> *(not really literally) >> > >> > >> > >> > -- >> > Best regards, >> > Ben Houston >> > Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom >> > http://Exocortex.com - Passionate CG Software Professionals. >> >> >> >> -- >> Best regards, >> Ben Houston >> Voice: 613-762-4113 Skype: ben.exocortex Twitter: @exocortexcom >> http://Exocortex.com - Passionate CG Software Professionals. > > > > --
Re: Maths problem (barycentric coordinates)
Thanks for your kind words Andy. I am planning a few more. This gives me opportunity to ask people here which concepts, areas of 3D mathematics are most difficult to master so that I can try to cover them up at my blog. The ones that I have in mind are : 1. Rotations - What the hell are quaternions, eulers etc. 2. Transforms and Matrix - why do we need them. 3. Half float precisions numbers and how exr uses them. 4. The math behind the stereoscopy. On Sun, Jul 21, 2013 at 2:47 PM, Andy Moorer wrote: > Alok since you bring it up I am reminded to belatedly thank you for this > article - it's a fantastic read, and your blog is a personal favorite. > > >
Re: Maths problem (barycentric coordinates)
Thanks very much for doing this. I look forward to testing it when I get back from holiday in a week. I did get something that works, by stripping back the 'calculate envelope weights' compound to the core maths, but I'm keen to see anything else. Paul On 21 Jul 2013, at 04:03, David Barosin wrote: > Hey Paul. Here's a scene that shows how to get a normalized weighted value. > It also shows how to use this weighted array on scale, rotation & color. It > uses a null group to influence particles. > > > On Wed, Jul 17, 2013 at 4:49 PM, Bk wrote: > Thanks for all the replies. It's much appreciated. I'll grind through them > tomorrow at work. > > > > > On 17 Jul 2013, at 19:26, Vladimir Jankijevic > wrote: > >> something we recorded last year while I was in NY: https://vimeo.com/44951318 >> maybe this helps :) >> >> Cheers >> Vladimir >> >> >> On Wed, Jul 17, 2013 at 2:05 PM, Vincent Ullmann >> wrote: >> Quote Paul: >> >> { >> Ive managed to get barycentric interpolation working for a flat plane, >> and only 3 points, but I need it to accept multiple points in 3d space. >> } >> >> Not sure if this helps, but some time ago i made a ICE-Compound for >> calulating barycentric-Coordinates, based on 3 3D-Vectors. >> Dont know if my formula was correct ;-) >> >> >> Am 17.07.2013 19:47, schrieb Alok Gandhi: >>> You can have a look at my blog post: >>> http://alokgandhi.com/blog/2012/05/28/barycentric-coordinates-and-the-magic-of-locations/ >>> >>> >>> On Wed, Jul 17, 2013 at 12:58 PM, Ben Houston wrote: >>> BTW here is our code for calculating barycoordinates from points and >>> creating points from barycoordinates: >>> >>> template >>> class Triangle3 { >>> public: >>> Vec3 a; >>> Vec3 b; >>> Vec3 c; >>> >>> Matrix44 getPointToBarycoordMatrix() const; >>> Matrix44 getBarycoordToPointMatrix() const; >>> }; >>> >>> template >>> inline Matrix44 Triangle3::getPointToBarycoordMatrix() const { >>> M44x pointToBarycoordMatrix; >>> bool success = inverseSafe( pointToBarycoordMatrix, >>> getBarycoordToPointMatrix() ); >>> if( ! success ) { >>> T oneThird = ((T)1.0)/((T)3.0); >>> //Vec3 center = ( a + b + c ) * oneThird; >>> return Matrix44( >>> 0, 0, 0, 0, >>> 0, 0, 0, 0, >>> 0, 0, 0, 0, >>> oneThird, oneThird, oneThird, 0); >>> } >>> return pointToBarycoordMatrix; >>> } >>> >>> template >>> inline Matrix44 Triangle3::getBarycoordToPointMatrix() const { >>> Vec3 n = normal(); >>> return Matrix44( >>> a[0], a[1], a[2], 1, >>> b[0], b[1], b[2], 1, >>> c[0], c[1], c[2], 1, >>> n[0], n[1], n[2], 0); >>> } >>> >>> And this you just multiple your point by the "pointToBarycoordMatrix" >>> matrix to get barycoords. And if you have barycoordinates, multiply >>> it by "getBarycoordToPointMatrix()" to get your point. >>> >>> We are using 4 coordinate barycoordinates where the fourth element is >>> the distance from the triangle plane in the normal direction. Just >>> set it to zero and you should be fine. The above can be converted to >>> Softimage Matrix types pretty easily. Probably could be added to the >>> Softimage SDK as well if it isn't already there. >>> >>> Best regards, >>> -ben >>> >>> >>> On Wed, Jul 17, 2013 at 12:04 PM, Ben Houston wrote: >>> > So barycoords for a triangle works well and I believe there are tons >>> > of references on the web for this. Barycoordinates for polygons is a >>> > bit more problematic because they are no longer linear but rather >>> > polynomials and thus harder to calculate. I'd stick with triangles >>> > and then all those web references should work well. >>> > >>> > Is your problem calculating them from points? >>> > >>> > Basically this is a great guide: >>> > >>> > http://en.wikipedia.org/wiki/Barycentric_coordinate_system >>> > >>> > -ben >>> > >>> > >>> > On Wed, Jul 17, 2013 at 11:38 AM, wrote: >>> >> Hi, I have spent days on this and I cant work it out >>> >> >>> >> I have a selection of points (not on a flat plane) and I have a test >>> >> position. >>> >> It returns an array that represents the weighting, related to the >>> >> proximity >>> >> to the other points. >>> >> >>> >> I want to have it so that when the test position is directly at a point, >>> >> the >>> >> value for that point in the array = 1 >>> >> and the rest will be zero >>> >> as the test point moves around the area it interpolates these values, but >>> >> they always add up to 1 >>> >> >>> >> It sounds really easy, but I’ve been literally* tearing my hair out over >>> >> this for days. >>> >> >>> >> Ive managed to get barycentric interpolation working for a flat plane, >>> >> and >>> >> only 3 points, but I need it to accept multiple points i
Re: Maths problem (barycentric coordinates)
I recently had to properly understand rotations on a low level and an article written by you would have been awesome. On Jul 21, 2013 9:19 PM, "Alok Gandhi" wrote: > Thanks for your kind words Andy. I am planning a few more. This gives me > opportunity to ask people here which concepts, areas of 3D mathematics are > most difficult to master so that I can try to cover them up at my blog. > > The ones that I have in mind are : > > 1. Rotations - What the hell are quaternions, eulers etc. > > 2. Transforms and Matrix - why do we need them. > > 3. Half float precisions numbers and how exr uses them. > > 4. The math behind the stereoscopy. > > > > On Sun, Jul 21, 2013 at 2:47 PM, Andy Moorer wrote: > >> Alok since you bring it up I am reminded to belatedly thank you for this >> article - it's a fantastic read, and your blog is a personal favorite. >> >> >>
Re: Maths problem (barycentric coordinates)
Isner's page on quaternions is still up, and it's still more than OK if you haven't bumped into it: http://www.isner.com/tutorials/quatSpells/quaternion_spells_14.htm Personally I've never quite understood the struggle with quaternions and rotations, I think most of it comes from the fact people are too used to numbers that have a Newtonian intuitiveness on a linear scale to them, and therefore are puzzled by the fact that the numbers in quaternions are not to be intuitively read and translated in your head the way Euler angles in a gimbal system or scalars in vector maths are. The basic concept of direction + roll and interpolation being "warped" in spherical space is not that un-intuitive to understand though. The rest is all down to simple matrix maths, which again tend to be overly mystified and puzzling to many, but if explained well and if segwayed from their 3D application (rather than from the abstracts of linear systems and general matrix composition) tend to be very intuitive. On Mon, Jul 22, 2013 at 8:10 AM, Leonard Koch wrote: > I recently had to properly understand rotations on a low level and an > article written by you would have been awesome. > On Jul 21, 2013 9:19 PM, "Alok Gandhi" wrote: > >> Thanks for your kind words Andy. I am planning a few more. This gives me >> opportunity to ask people here which concepts, areas of 3D mathematics are >> most difficult to master so that I can try to cover them up at my blog. >> >> The ones that I have in mind are : >> >> 1. Rotations - What the hell are quaternions, eulers etc. >> >> 2. Transforms and Matrix - why do we need them. >> >> 3. Half float precisions numbers and how exr uses them. >> >> 4. The math behind the stereoscopy. >> >> >> >> On Sun, Jul 21, 2013 at 2:47 PM, Andy Moorer wrote: >> >>> Alok since you bring it up I am reminded to belatedly thank you for this >>> article - it's a fantastic read, and your blog is a personal favorite. >>> >>> >>> -- Our users will know fear and cower before our software! Ship it! Ship it and let them flee like the dogs they are!