• [prog. in c] how to make stable paricles

    From fir@profesor.fir@gmail.com to comp.lang.c on Tue Nov 12 21:36:56 2024
    From Newsgroup: comp.lang.c

    see that simulation

    https://www.youtube.com/watch?v=pP-uCjLp3RY

    there is a group of lights/dots/balls/points (say atoms) and such fotces
    are applied
    1) if the ball is into wall apply a force proportional to depth of
    being into wall

    point[i].vx -= H* wall_penetration_x ;
    point[i].vy -= H* wall_penetration_y ;

    2) if the ball is to much close to other ball same the force related to
    depth of penetration is applied (though here its square)


    point[i].vx+= (dx/dist)* (n_pen*B)*(n_pen*B) /point[i].mass ;
    point[i].vy+= (dy/dist)* (n_pen*B)*(n_pen*B) /point[i].mass ;


    i chose it partially conceptually - knowing a=F/m - and partially experimantally..it work wery well imo

    the problem is i want to apply some ball-ball force additional to
    this repeling one that would make those ball build in a kinda multi-ball relativly stable "particles" ... and the question is what this force
    should be?

    here above on this video the lines you see are drawed when this third
    force start to work.. (so teh lines arre kinda optical debug showing
    how it work) i applied some but the particles that forms are much to dynamical, oscilate llike crazy then sometimas shot one of atoms out and
    so on

    and i need a stable one

    i experimented with this additional link force but not much
    what i experimented was like adding link it is attraction force
    that enebles when two points are closer than 1.5*link distance, which is
    20 units (pixels) it is this attract force work on distance closer than
    30 pixels

    the force is something like

    double link_dist = 20;
    double dx = point[i].x - point[n].x;
    double dy = point[i].y - point[n].y;
    double Mi = point[i].mass;

    double dist = sqrt(dx*dx + dy*dy );

    if(dist>link_dist*1.5) return;

    double L = 1.;
    double p = (dist - link_dist)*L;

    point[i].vx+= -(dx/dist)*(p*p)*sign(p)/point[i].mass;
    point[i].vy+= -(dy/dist)*(p*p)*sign(p)/point[i].mass;

    if(!m_toggler)
    DrawLine2d(point[i].x, point[i].y, point[n].x, point[n].y,0xffffff );

    but as i said the results are to messy and i need stable little "solid
    bodies" i mean more "stiff" particles

    some ideas as to what this link force should be?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From fir@profesor.fir@gmail.com to comp.lang.c on Tue Nov 12 21:40:56 2024
    From Newsgroup: comp.lang.c

    fir pisze:
    see that simulation

    https://www.youtube.com/watch?v=pP-uCjLp3RY

    LOL, sorry for that sound it was by assidnt sound of the youtobe
    movie i watched in background and i new in this program to make youtube
    videos
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From fir@profesor.fir@gmail.com to comp.lang.c on Tue Nov 12 22:14:09 2024
    From Newsgroup: comp.lang.c

    btw as i learned make ytb videos check put a movie of one of the first
    demos compiled by my furia compiler under construction (which make
    asembly tahat asembled my org-asm assembler)..thsi demu is compiled by
    furia but it uses my green-fire dll library which contains a code for
    per pixel rasterizer where i can test simple 2d/3d codes rendered by my routines all on cpu

    https://www.youtube.com/watch?v=F17xhXD9dIU

    this few years old o worked on this when i wrote on thsi already here -
    the source of this must also be in that posts..recently i got not much
    power to code as getting old :c (but eventually should finish the compiler)


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From fir@profesor.fir@gmail.com to comp.lang.c on Tue Nov 12 22:41:10 2024
    From Newsgroup: comp.lang.c

    fir pisze:
    see that simulation

    https://www.youtube.com/watch?v=pP-uCjLp3RY

    there is a group of lights/dots/balls/points (say atoms) and such fotces
    are applied
    1) if the ball is into wall apply a force proportional to depth of
    being into wall

          point[i].vx -= H* wall_penetration_x ;
          point[i].vy -= H* wall_penetration_y ;

    2) if the ball is to much close to other ball same the force related to depth of penetration is applied (though here its square)


       point[i].vx+= (dx/dist)* (n_pen*B)*(n_pen*B) /point[i].mass ;
       point[i].vy+= (dy/dist)* (n_pen*B)*(n_pen*B) /point[i].mass ;


    i chose it partially conceptually - knowing a=F/m - and partially experimantally..it work wery well imo

    the problem is i want to apply some ball-ball force additional to
    this repeling one that would make those ball build in a kinda multi-ball relativly stable "particles" ... and the question is what this force
    should be?

    here above on this video the lines you see are drawed when this third
    force start to work.. (so teh lines arre kinda optical debug showing
    how it work) i applied some but the particles that forms are much to dynamical, oscilate llike crazy then sometimas shot one of atoms out and
    so on

    and i need a stable one

    i experimented with this additional link force but not much
    what i experimented was like adding link it is attraction force
    that enebles when two points are closer than 1.5*link distance, which is
    20 units (pixels) it is this attract force work on distance closer than
    30 pixels

    the force is something like

     double link_dist = 20;
      double dx = point[i].x - point[n].x;
      double dy = point[i].y - point[n].y;
      double Mi = point[i].mass;

      double dist = sqrt(dx*dx + dy*dy );

     if(dist>link_dist*1.5) return;

      double L = 1.;
      double p =  (dist - link_dist)*L;

        point[i].vx+= -(dx/dist)*(p*p)*sign(p)/point[i].mass;
        point[i].vy+= -(dy/dist)*(p*p)*sign(p)/point[i].mass;

      if(!m_toggler)
       DrawLine2d(point[i].x, point[i].y, point[n].x, point[n].y,0xffffff );

    but as i said the results are to messy and i need stable little "solid bodies" i mean more "stiff" particles

    some ideas as to what this link force should be?

    note as to "stiff" particles (not sure as to this word becouse weak
    english) they are possible as check some of my old demo

    https://www.youtube.com/watch?v=0bw_R8nIIG4

    this 9 dot "Rectangle" is made by simple 1-1 link forces but the
    difference is i set up those initial distances like 100 and sqrt (100) = 141.42 and so on by hand from init function in code

    and this is very tiresome to set upo by hand so i think it would be give
    some force that works liek chemistry it is glues that balls together
    naturall way not by tedious set up

    - but its the proof that it is generaly possible to have stiff particles
    (more to say its making like rotating objests with angular momentum
    without any code of angular momentum just simple lineas bal-ball forces
    and newtonian a=F/m)
    --- Synchronet 3.20a-Linux NewsLink 1.114