[DiscordArchive] One is the average and one is the center I am guessing?
[DiscordArchive] One is the average and one is the center I am guessing?
Archived author: michael • Posted: 2021-08-20T12:10:48.602000+00:00
Original source
One is the average and one is the center I am guessing?
Archived author: schlumpf • Posted: 2021-08-20T12:11:34.614000+00:00
Original source
the average *is* the center, depending on definition
Archived author: schlumpf • Posted: 2021-08-20T12:12:23.056000+00:00
Original source
for the first, just average all points.
for the second, determine the AABB enclosing the mesh (see how it is done for the entire model in the M2 header vertex box) and average those points, i.e. get the center of the AABB
Archived author: michael • Posted: 2021-08-20T12:16:34.683000+00:00
Original source
But the center of a box around the points wouldnt that just be the max point in each axis subtracted from the min?
Archived author: michael • Posted: 2021-08-20T12:17:13.643000+00:00
Original source
Wait no that's the length of the model
Archived author: michael • Posted: 2021-08-20T12:18:46.121000+00:00
Original source
minX+((maxX-minX)/2)
Archived author: schlumpf • Posted: 2021-08-20T12:22:28.665000+00:00
Original source
which is the same as (min + max) / 2, i.e. the average
Archived author: schlumpf • Posted: 2021-08-20T12:24:30.810000+00:00
Original source
just that for the box you can ignore 6 of the 8 points if you choose two opposing ones. I probably wouldn't optimize those 0.2ms of wasted computation for the benefit of writing
```
mesh.centerPosition = average (all_vertices);
mesh.sortCenterPosition = average (aabb (all_vertices));
```
Archived author: michael • Posted: 2021-08-20T12:27:55.433000+00:00
Original source
I'll have to research what an axis aligned bounding box is cause maybe I don't get it
Archived author: michael • Posted: 2021-08-20T12:28:39.547000+00:00
Original source
Or are you saying the min max / 2 is the sortCenterPosition?