Physion

  • Increase font size
  • Default font size
  • Decrease font size
Welcome, Guest
Username Password: Remember me

Buoyant Force
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Buoyant Force

Buoyant Force 4 years, 8 months ago #815

  • Filippo
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hi, I'm an Italian teacher. I created simple Physion applets to simulate physical experiments have shown that the pupils. I'm trying to build an applet to the problems of buoyancy. Someone could help me? The Buoyant Force should apply only to the part of the body immersed in water. I tried to fix it but with little success. Here is my attempt. Thank you
Last Edit: 4 years, 8 months ago by Filippo.

Re: Buoyant Force 4 years, 8 months ago #816

  • Lynxx
  • OFFLINE
  • Moderator
  • Java/C#-Developer
  • Posts: 223
Hi,

you forgot a link to your scene:

This image is hidden for guests. Please log in or register to see it.

The code is fine, some unnecessary calculations like
	if (a)	{
this.Pe = Math.round(a);
this.Fe = Math.round(this.Mass*(world.GravityY)+a);
}

which are never used, could be removed.

I guess your problem is the ongoing up/down-movement.
Simply try setting your LinearDamping to 1 and AngularDamping to 0,5 on Legno & Piombo.

Edit: I've uploaded a scene with some changes, the water was moved to the back - this way you can still drag objects under water, the Code was moved to Acqua->OnStart and the objects just call UpdateBuoyant(this); in OnUpdate, this way you only need to change 1 code.

This image is hidden for guests. Please log in or register to see it.

Have phun.

2nd Edit: Oops, forgot using Radius for circles ..
Infinity is vast, especially near end.
bye, Lynxx
Last Edit: 4 years, 8 months ago by Lynxx.

Re: Buoyant Force 4 years, 8 months ago #819

  • Filippo
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hi, you are the best. It's OK. Thank you. Thank you and again Thanks. .
Last Edit: 4 years, 7 months ago by Filippo.

Re: Buoyant Force 4 years, 7 months ago #821

  • Filippo
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
I am trying to extend the code to any polygon that is submerged.
I need a code that will give me the points of the vertices of any polygon drawn.
I tried to derive it by this code:
this.transpunti = this.GeometryString.split ('');
for (i = 0; i <this.transpunti.length; i + +) {
this.transcoor [i] = this.transpunti [i]. split (',');
this.P [i] = new QPointF (this.transcoor [i] [0], this.transcoor [i] [1]);
this.H [i] = this.x + this.transcoor [i] [1];
}
but it's not good because this.transcoor [i] is as type string.
Help again

Re: Buoyant Force 4 years, 7 months ago #822

  • Lynxx
  • OFFLINE
  • Moderator
  • Java/C#-Developer
  • Posts: 223
This should do it:
var number = parseInt("10");
or
var number = parseFloat("10.2");
Infinity is vast, especially near end.
bye, Lynxx

Re: Buoyant Force 4 years, 7 months ago #823

  • Filippo
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Thank you. I try it.
  • Page:
  • 1
Moderators: Lynxx, Glenn555
Time to create page: 0.13 seconds