Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Centroid Question
#10
(07-14-2024, 06:14 AM)aadityap0901 Wrote: For a given set of points like: [0, 0], [3, 3], [6, 6] ........
The mid point will be: Mid_X = Average(All X Co-ordinates), Mid_Y = Average(All Y Co-ordinates)

if you want a mass center with a non-uniform distribution of mass as particles:
Mid_Mass_X = Sum(X(I) * M(I)) / Sum (M(I)), Mid_Mass_Y = Sum(Y(I) * M(I)) / Sum (M(I))

For example:
[0, 0], [5, 5], [7, 4]
Mid_Point = [ (0 + 5 + 7) / 3, (0 + 5 + 4) / 3 ] = [4, 3]
For non uniform mass distribution: (written as [X, Y, Mass] at point [X, Y])
[0, 0, 1], [5, 2, 3], [4, 5, 3], [7, 9, 2]
Mid_Point = [ (0 * 1 + 5 * 3 + 4 * 3 + 7 * 2) / (1 + 3 + 3 + 2), (0 * 1 + 2 * 3 + 5 * 3 + 9 * 2) / (1 + 3 + 3 + 2) ] = [4.55, 4.33]
Ah, ok, so the average is what I am looking for here. Thank you for the information.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply


Messages In This Thread
Centroid Question - by TerryRitchie - 07-13-2024, 06:00 PM
RE: Centroid Question - by Pete - 07-13-2024, 06:26 PM
RE: Centroid Question - by bplus - 07-13-2024, 07:58 PM
RE: Centroid Question - by TerryRitchie - 07-13-2024, 09:20 PM
RE: Centroid Question - by Pete - 07-13-2024, 09:44 PM
RE: Centroid Question - by justsomeguy - 07-13-2024, 11:56 PM
RE: Centroid Question - by bplus - 07-14-2024, 12:00 AM
RE: Centroid Question - by aadityap0901 - 07-14-2024, 06:14 AM
RE: Centroid Question - by TerryRitchie - 07-14-2024, 01:14 PM
RE: Centroid Question - by Kernelpanic - 07-14-2024, 01:11 PM
RE: Centroid Question - by bplus - 07-14-2024, 03:42 PM
RE: Centroid Question - by Kernelpanic - 07-14-2024, 06:24 PM
RE: Centroid Question - by bplus - 07-14-2024, 06:55 PM
RE: Centroid Question - by Kernelpanic - 07-15-2024, 03:07 PM
RE: Centroid Question - by Pete - 07-14-2024, 07:15 PM
RE: Centroid Question - by vince - 07-15-2024, 03:46 AM
RE: Centroid Question - by bplus - 07-15-2024, 01:02 PM
RE: Centroid Question - by Pete - 07-16-2024, 12:33 AM



Users browsing this thread: 2 Guest(s)