Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Apr 2011
Offline Last Active Today, 02:52 PM

Topics I've Started

Find triangles half of surface, and tetrahedron half of volume

Yesterday, 03:36 PM


on pic you see that blue color has the same area as red one  (and they are not sliced)


i need to find new base and new h that  it will have half of original tri area [to be more precise for triangle i need the point ].And for tetrahedron thing i think i will have to start from that tip of pyramid, otherwise it will break my calculations  :x


for thetrahedron it seems it has the same base * height  problem, anyway i need to find the point that lies on new base if i find new h for that base, so it will have half volume of original one, i will be able to easily claculate the point for it



all triangle vertices are known, (for thetrahedron base and h is known too). triangle can be any triangle.

Apply drag to rotation

07 February 2016 - 01:45 PM

ihave a body lets say its liek this both spheres are connected so when i move one other moves too lets say center of mass is hooked so i can only rotate this 'body'





So whenever i apply a force to one sphere the rotation occurs and it produces drag, now how should i apply this drag (i understand that drag will be generated for both spheres)


my code looks like this

for (int i=0; i <num_of_spheres; i++)
if (i==0) apply_force_to_this_sphere();

vec3 cog2cob_vec = vectorAB(pos + WORLD_MAT * CENTER_OF_GRAVITY, sphere[i].geometric_center);

vec3 ETorque = cog2cob_vec	*	SPHERE_FORCE;
vec3 EAngAcc = ETorque / EMOI;

vec3 EAngVel = EAngAcc*dt;
vec3 EAngMov = EAngVel*dt;

vLocalAngularMoment = vLocalAngularMoment + EAngMov*RAD_TO_DEG;


Now i am confused where in the code should i apply drag


should i first calculate the rotation without drag then check for angular velocity and then apply drag force and change angular velocity again?

or should i apply drag to each sphere like

for (int i=0; i <num_of_spheres; i++) {
if (i==0) apply_force_to_this_sphere();

for (int n=0; n < num_of_spheres; n++)
if (i!=n)
apply drag to each sphere


for (int i=0; i <num_of_spheres; i++)
vec3 SPHERE_FORCE = vec3(0.0, 0.0,0.0);
if (i==0) apply_force_to_this_sphere(); //SPHERE_FORCE = SPHERE_FORCE + thrust

vec3 cog2cob_vec = vectorAB(pos + WORLD_MAT * CENTER_OF_GRAVITY, sphere[i].geometric_center);

vec3 ETorque = cog2cob_vec	*	(SPHERE_FORCE+drag_for_this_sphere_based_on_angular_vel);
vec3 EAngAcc = ETorque / EMOI;

vec3 EAngVel = EAngAcc*dt;
vec3 EAngMov = EAngVel*dt;

vLocalAngularMoment = vLocalAngularMoment + EAngMov*RAD_TO_DEG;


thus last example shows that angular vel will change each iteration thus i think it will somehow apply greater drag to other sphere, and since distance from center_of_mass to both spheres in this case is the same it should have the same drag value(not direction but length)


so how do i do it?

Constructor + putting into an array

07 February 2016 - 06:50 AM

i have such constructor

THullPolygon(float subarea, vec3 cp, vec3 A, vec3 B, vec3 C, vec3 A2, vec3 B2, vec3 C2) : submerged_area(subarea), center_point(cp),
TrisVerts[0](A), TrisVerts[1](B), TrisVerts[2](C), TrisVerts[3](A2), TrisVerts[4](B2), TrisVerts[5](C2)
pressure = 0.0;
pressure2 = 0.0;
tris = 2;


vec3 TrisVerts[6];

now compiler throws ( expected at

TrisVerts[0](A), TrisVerts[1](B), TrisVerts[2](C), TrisVerts[3](A2), TrisVerts[4](B2), TrisVerts[5](C2)

but when i change that to

ka(A), kb(B), kc(C), ka2(A2), kb2(B2), kc2(C2)


vec3 ka, kb, kc;
vec3 ka2, kb2, kc2;

it compiles, so is there a way to initialize an array of do i have to do this by declaring 6 different vars?

Mass distribution

06 February 2016 - 01:26 PM

I need somehow to find a mass of each point on the surface of my ships hull (that souds silly)


because i need to apply rotation (torque) to each individual part of the triangle (that forms a hull) (I = I0 + md^2)


like shown on this pic




since i always was slicing body into smaller fragments like (cubes) i was lets say i divide one cube into smaller ones (all smaller cubes have the same dimension) so i could eaisly estimate the mass of the cube and apply that torque, now i am completely out of ideas how should i do that.



How do i find

05 February 2016 - 04:08 PM

I want to refer to this:






i will describe it shortly


guy uses such forces

Viscous Water Resistance - the force that acts like skin friction drag


Pressure Drag Forces - something that acting towards/outwards the hull center within each surface of the hull model,


guy uses some coefficients that i am unable to find: 


FDi = -(CPD1*Vi/Vr + CPD2(Vi/Vr)^2)*SubmergedSurf*(cos(Thetai)^fp * surf_normal, if cos(Thetai)

fp -> falloff power of the facing dot product,

CPD1 - linear pressure drag coeff
CPD2 - quadric pressure drag coeff

FDi = -(CSD1*Vi/Vr + CSD2(Vi/Vr)^2)*SubmergedSurf*(cos(Thetai)^fs * surf_normal, if cos(Thetai),


Same as above but instead of pressure we call them suction forces



cos(thetai) is an angle between velocity and surface normal


i wonder how to determine such coefficients.

Why i cant use here drag equation with a changeable drag coeff depending on fluid velocity + surface velocity multiplied by abs(arccos(cos(thetai))) / pi to get the max value when surface is facing exactly the velocity vector



Slamming Forces - same quaestion as above why i cant just use drag equation for that.



and how to calculate a volume of that shape:





i ask that becasue i have divided hull into 8 boxes that are coevering it and use their center as the hooks for forces to apply,

i divide each box by one plane (they may differ for different boxes) i cant get the image of slicing such model where everything is connected and i have different slice planes for different triangles in the hull.







more over i am not quite sure if guy uses the buoyant force at all) or may he calculates it by looping through surfaces submerged in water and applies a force pointing -surface_normal for each depending on hull vel + fluid veli


i mean depending on how deep a triangle of the hull penetrates the water it has different pressure acting on it along through its shape (lets take a mean of that) so actually pressure of water below that surface pushes it up - i would stand for that, but i dont understand the equation + guy uses Vr which is unknown. (despite 6 other coefficients that are really hard to guess)


so there should be a drag equation for that since P = F / A, its strictly related to the velcotiy of fluid + the hull triangle(surface), and force which could be found by F=ma but theres a problem how do i find a proper mass of water that hit the target, thats way out of scope when i see 1000m^3 of water hitting the boardside, yeah i could  do p = m / V => m = p*V (density * volume) but how to find then a volume of it.




more over going back to my simple implementation which acts wierdo on small waves (along with a 'rough water')

theres another thing how do i find water velocity i only have a heightmap that changes i have all vertices calculated for each timestep so i could know the translation along y axis for the water but how to compute x,z velocity from that so i could apply a proper drag for each surface of the hull.


because without it i can only apply drag putting in equation ship velocity and forcing it to act in the opposite direction (of that ships vel) which gives me really bad results.



and last confusion should i add bouyancy force when i calculated pressure acting on each surface (in my understanding that should be the buoyancy force itself)


i wouldn;t even ask how to apply some of forces since i dont even have a mass for each surface...