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

Possibly Related Threads…
Thread Author Replies Views Last Post
  _Putimage Question. Pete 11 723 01-04-2026, 09:33 PM
Last Post: Pete
  Nice simple, I hope, question Mad Axeman 4 363 12-20-2025, 09:28 PM
Last Post: SMcNeill
  NewBie Question niteflyer 2 349 11-06-2025, 07:11 PM
Last Post: Petr
  A Question About _MAPTRIANGLE Magdha 2 391 11-02-2025, 11:37 AM
Last Post: Magdha
  '$include: 'file.tmr' Timing Question pmackay 2 444 10-16-2025, 12:20 PM
Last Post: a740g

Forum Jump:


Users browsing this thread: 1 Guest(s)