Author Topic: Area enclosed by a polyline script  (Read 16186 times)

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Area enclosed by a polyline script
« Reply #30 on: November 21, 2021, 01:48:27 am »
Dear Eddy

I have had a need to calculate second moments of area of polygon shapes, so I have take the liberty to update your Area plugin as it provided most of the basic infrastructure.  I have the V1.2 source, and I think I have included. the v1.3 updates (?? - I think the changes only related to the TextTranslation in the result dialog).  I am including here V1.4 for testing.

thanks
Geoff

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4854
    • View Profile
Re: Area enclosed by a polyline script
« Reply #31 on: November 21, 2021, 11:19:14 am »
Geoff,

As always, that's fine, it was Lloyd's script in the first place anyway   ;)

The calculations work correctly when the object is centred at 0,0 (I tried a rectangle and circle)but if they are moved away from that position then the numbers change, is that how it should be ?

« Last Edit: November 21, 2021, 15:31:45 pm by EddyCurrent »
Made in England

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Area enclosed by a polyline script
« Reply #32 on: November 21, 2021, 23:26:57 pm »
Dear Eddy

The second moments of area are defined for a nominated axis, often the centroidal axes that are parallel to the cartesian X or Y axis, but it doesn't have to be.  To get the correct Ixx and Iyy for this case you need to place the centroid of the shape at the origin (X=0, Y=0).  If you move the centroid to some other location then the Ixx and Iyy will change according to the Parallel Axis Theorem.

Does this explain?

Geoff

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4854
    • View Profile
Re: Area enclosed by a polyline script
« Reply #33 on: November 22, 2021, 11:07:32 am »
Geoff,

Thanks, I see that but should the plugin not adjust the numbers so that an object's centroid becomes a virtual 0,0 ?
In other words, rather than moving the object centroid to 0,0 we should move 0,0 to the object's centroid.
« Last Edit: November 22, 2021, 14:23:21 pm by EddyCurrent »
Made in England

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Area enclosed by a polyline script
« Reply #34 on: November 22, 2021, 23:15:19 pm »
Dear Eddy

Yes, we could do that, but it would then not be possible to compute Ixx and Iyy at some other axes (like the bottom edge of a rectangular shape) -without some additional manual  computation (like Ixx +  A*d^2)

Geoff

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 4854
    • View Profile
Re: Area enclosed by a polyline script
« Reply #35 on: November 23, 2021, 09:41:32 am »
Geoff,

I chose a bad example by using the centroid because rotation can be about any point not just the centre, e.g. a pendulum.

In general terms then we should be able to draw an object anywhere in the CamBam window and specify the point of rotation which shall then become virtual 0,0

Failing that, some instructions would have to accompany the plugin to indicate centre of rotation needs to be located at CamBam's 0,0 

The plugin seems to working as it should, with the regular polygons I used for testing, what I'm on about is the user interface.


« Last Edit: November 23, 2021, 10:05:45 am by EddyCurrent »
Made in England

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 239
    • View Profile
Re: Area enclosed by a polyline script
« Reply #36 on: November 23, 2021, 10:08:00 am »
Dear Eddy

We are getting into deep water here - it is a bit more complicated that I have indicated.  It might be best to refer anyone interested to a good description of second moments of area e.g Wikipedia (https://en.wikipedia.org/wiki/List_of_second_moments_of_area) rather than try to to it ourselves and mess it up!

Suffice to say: The second moment of area of a shape is defined about an axis in the plane of the shape.  For symmetrical shapes (like rectangles) it will typically be aligned with one of the sides, it may be through the centroid but may be located elsewhere, like along one of the edges, aligned with X or Y.  Remember that the Second Moment of Area is a property of planar shapes, while it can be related to Moment of Inertia that is a property of solids (with mass), it is not the same.

For the plugin then:
  • To get the Ixx and Iyy about the centroidal axis (a common task)  then the shape must be placed so that its centroid is at the origin.  You can use the Centroid plugin to locate it.
  • To get the Ixx and Iyy about some other axes then the shape must be placed so that these axis are aligned with X=0 and Y=0 respectively

Geoff