POV-Ray : Newsgroups : povray.binaries.animations : help debug my 1.1 mechsim anim Server Time
1 Nov 2024 07:28:35 EDT (-0400)
  help debug my 1.1 mechsim anim (Message 1 to 6 of 6)  
From: Greg M  Johnson
Subject: help debug my 1.1 mechsim anim
Date: 18 Oct 2004 21:30:38
Message: <41746e3e@news.povray.org>
using 1.1

I was trying to get it to bounce of a slanted plane, but it comes to rest on
a non-existent plane.


Post a reply to this message


Attachments:
Download 'blocksu01.pov.txt' (3 KB) Download 'blocksu0101.mpg' (228 KB)

From: Mike Williams
Subject: Re: help debug my 1.1 mechsim anim
Date: 18 Oct 2004 23:17:40
Message: <cv8UUGA6cIdBFwWN@econym.demon.co.uk>
Wasn't it Greg M. Johnson who wrote:
>using 1.1
>
>I was trying to get it to bounce of a slanted plane, but it comes to rest on
>a non-existent plane.
>

You've rigged your camera in such a way that the z plane is horizontal,
so your "#declare fn_Env = function { z }" creates a ground plane which
you include in your environment block (so that the objects bounce off
it) but you never render it.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Greg M  Johnson
Subject: Re: help debug my 1.1 mechsim anim
Date: 19 Oct 2004 07:24:42
Message: <4174f97a$1@news.povray.org>
okay cool, thanks for the info.

How would one simply add a sphere?

"Mike Williams" <nos### [at] econymdemoncouk> wrote in message
news:cv8### [at] econymdemoncouk...
> Wasn't it Greg M. Johnson who wrote:
> >using 1.1
> >
> >I was trying to get it to bounce of a slanted plane, but it comes to rest
on
> >a non-existent plane.
> >
>
> You've rigged your camera in such a way that the z plane is horizontal,
> so your "#declare fn_Env = function { z }" creates a ground plane which
> you include in your environment block (so that the objects bounce off
> it) but you never render it.
>
> -- 
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

From: Mike Williams
Subject: Re: help debug my 1.1 mechsim anim
Date: 19 Oct 2004 10:18:55
Message: <xmmP2AATwRdBFwDM@econym.demon.co.uk>
Wasn't it Greg M. Johnson who wrote:
>okay cool, thanks for the info.
>
>How would one simply add a sphere?

I believe that in 1.1 you can use any object as the environment, so that
presumably allows you to something like this:

#declare Obj_Env = union {
  object {plane2}
  sphere {0,1}
}

environment {
  object Obj_Env
  stiffness 240000
  damping 35000
  friction 0.2, 1.001
}


Or you can combine two functions, which will also work with versions
that only work with particular types of object.

#declare fn_Env = function { min( (z+x) , f_sphere(x,y,z,1) ) }

environment {
  function { fn_Env(x, y, z) } 
  stiffness 240000
  damping 35000
  friction 0.2, 1.001
}

[If you use both an object and a function, it ignores the object.]

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: gregjohn
Subject: Re: help debug my 1.1 mechsim anim
Date: 20 Oct 2004 12:45:00
Message: <web.41769534fda580d440d56c170@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> I believe that in 1.1 you can use any object as the environment, so that
> presumably allows you to something like this:
>

Mike, I cannot get it to work.  Consider this code:

// Persistence Of Vision Ray Tracer Scene Description File
// -------------------------------------------------------
// File: @(#)blocks.pov
// Description: mechanics simulation sample scene [without iso-defined
objects]
// Features demonstrated: mechsim
// Creation Date: $ 14 Oct 2002, 16:55:14 $
// Last modified: $ 12 Jul 2004, 22:36:49 $
// Author: Christoph Hormann
// major modifications by Greg M. Johnson
//
// @@ Demonstrating groups and mass-face-collisions.
//
// Render instructions:
// --------------------
//
// First render as still with:
//
// -w320 -h240
//
// Then as animation with:
//
// -w320 -h240 +a0.3 -j +kff70

#version unofficial megapov 1.1;

#include "mechsim.inc"

#declare fn_Env = function { z }

#declare Trans1 =
  transform {
    translate -1.5*<0.7, 0.7, 0>
    rotate -40*z
    translate 1.8*x
    translate 0.5*z
  }

#declare Trans2 =
  transform {
    translate -1.5*<0.7, 0.7, 0>
    rotate 25*z
    translate -2.1*x
    translate 0.5*z
  }

#declare Trans3 =
  transform {
    translate -<4*0.55, 0.55, 0>
    translate 2.9*z
  }

#declare Envy=union{
        sphere{0,2 pigment {rgb 0.5} finish {reflection 0.3} translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 0*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 60*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 120*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 180*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 240*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 300*z
translate -2*z}
        plane{z,-3 pigment {rgb 1 }  finish { ambient 0.05 diffuse 0.45 }}
        }

object{Envy}

global_settings {
  max_trace_level 10
  assumed_gamma 1

  mechsim {
    gravity <0, 0, -9.81>
    method 2
    bounding 3

    environment {
      //function { fn_Env(x, y, z) }
      object Envy
      stiffness 240000
      damping 35000
      friction 0.2, 1.001
    }

    collision {
      2, 2
      stiffness 180000
      damping 30000 //5000
      friction 0.2, 1.001
    }

    #if (clock_on)
      step_count 300 //500
      time_step (1/30)/300 //500

      topology {
 load_file "blocks1.dat"
 save_file "blocks1.dat"
      }
    #else
      step_count 0
      topology {

        #declare Stiff=24000;
        #declare Damp=3000;
        //#declare Stiff=52000;
        //#declare Damp=2500;

        group {
   MechSim_Generate_Grid_Std(<0, 0, 0>, 0.1, 22000, Stiff, Damp, true, <0.7,
0.7, 0.7>, <4, 4, 4>, Trans1, 3)
 }
        group {
   MechSim_Generate_Grid_Std(<0, 0, 0>, 0.1, 22000, Stiff, Damp, true, <0.7,
0.7, 0.7>, <4, 4, 4>, Trans2, 3)
 }
        group {
   MechSim_Generate_Grid_Std(<0, 0, 0>, 0.1, 22000, Stiff, Damp, true,
<0.55, 0.55, 0.55>, <9, 3, 3>, Trans3, 3)
 }
 save_file "blocks1.dat"
      }
    #end

  }
}



//MechSim_Show_All_Objects(-1, true, false, "")
MechSim_Show_Grid(0, 4,4,4, true, false, 0, "")
MechSim_Show_Grid(108, 4,4,4, true, false, 0, "")
MechSim_Show_Grid(216, 9, 3, 3, true, false, 0, "")


camera {
  location    <15, -10, 3.5>*1.4
  direction   y
  sky         z
  up          z
  right       (4/3)*x
  look_at     <0, 0, 0.>
  angle       30
}

light_source {
  <3.2, -0.3, 1.8>*100000
  color rgb <1.6, 1.5, 1.0>
}

sky_sphere {
  pigment {
    gradient z
    color_map {
      [0.00 rgb <0.8,0.9,1.0>]
      [0.10 rgb <0.6,0.7,1.0>]
      [0.25 rgb <0.2,0.3,0.8>]
    }
  }
}

//---------end of SDL
//---------end of SDL


Post a reply to this message

From: Mike Williams
Subject: Re: help debug my 1.1 mechsim anim
Date: 20 Oct 2004 14:38:18
Message: <99dTBBA9BrdBFwCo@econym.demon.co.uk>
Wasn't it gregjohn who wrote:
>Mike Williams <nos### [at] econymdemoncouk> wrote:
>> I believe that in 1.1 you can use any object as the environment, so that
>> presumably allows you to something like this:
>>
>
>Mike, I cannot get it to work.  Consider this code:

Did you notice the warning that object environments are not recommended 
with higher order integration methods?

I'd suggest either using integration method 1, or using a function 
environment.

Here's your scene with method 2 and a function environment. I've chosen 
to RENDER the equivalent object and just use the function for the 
mechsim environment calculation, because the isosurface renders slowly.

If you're not comfortable with writing your own functions, then 
consider getting hold of isocsg.


// Persistence Of Vision Ray Tracer Scene Description File
// -------------------------------------------------------
// File: @(#)blocks.pov
// Description: mechanics simulation sample scene [with iso-defined objects]
// Features demonstrated: mechsim
// Creation Date: $ 14 Oct 2002, 16:55:14 $
// Last modified: $ 12 Jul 2004, 22:36:49 $
// Author: Christoph Hormann
// major modifications by Greg M. Johnson
//
// @@ Demonstrating groups and mass-face-collisions.
//
// Render instructions:
// --------------------
//
// First render as still with:
//
// -w320 -h240
//
// Then as animation with:
//
// -w320 -h240 +a0.3 -j +kff70

#version unofficial megapov 1.1;

#include "mechsim.inc"

#declare Trans1 =
  transform {
    translate -1.5*<0.7, 0.7, 0>
    rotate -40*z
    translate 1.8*x
    translate 0.5*z
  }

#declare Trans2 =
  transform {
    translate -1.5*<0.7, 0.7, 0>
    rotate 25*z
    translate -2.1*x
    translate 0.5*z
  }

#declare Trans3 =
  transform {
    translate -<4*0.55, 0.55, 0>
    translate 2.9*z
  }


#include "functions.inc"

#declare F_plane=function{z+3}
#declare fn_Env=function {min (
   F_plane(x,y,z),
   #declare N=0;
   #while (N<6) 
     f_sphere(x-4*cos(N*pi/3),y-4*sin(N*pi/3),z+2,1),
     #declare N=N+1;
   #end
   f_sphere(x,y,z+2,2)
  )
}


#declare Envy=union{
        sphere{0,2 pigment {rgb 0.5} finish {reflection 0.3} translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 0*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 60*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 120*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 180*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 240*z
translate -2*z}
        sphere{x*4,1 pigment {rgb 0.5} finish {reflection 0.3} rotate 300*z
translate -2*z}
        plane{z,-3 pigment {rgb 1 }  finish { ambient 0.05 diffuse 0.45 }}
        }

// Use this for rendering because it's faster
object{Envy}

// Use this if you want to check that fn_Env actually matches the "Envy" object
//isosurface {function {fn_Env(x,y,z)}
//  contained_by {box{ <-20,-20,-4><20,20,3>}}
//  pigment {rgb 0.5}
//}


global_settings {
  max_trace_level 10
  assumed_gamma 1

  mechsim {
    gravity <0, 0, -9.81>
    method 2
    bounding 3

    environment { 
      // use this for simulating because object environments
      // may not work if the method is not 1
      function { fn_Env(x, y, z) }
      //object Envy
      stiffness 240000
      damping 35000
      friction 0.2, 1.001
    }

    collision {
      2, 2
      stiffness 180000
      damping 30000 //5000
      friction 0.2, 1.001
    }

    #if (clock_on)
      step_count 300 //500
      time_step (1/30)/300 //500

      topology {
 load_file "blocks1.dat"
 save_file "blocks1.dat"
      }
    #else
      step_count 0
      topology {

        #declare Stiff=24000;
        #declare Damp=3000;
        //#declare Stiff=52000;
        //#declare Damp=2500;

        group {
   MechSim_Generate_Grid_Std(<0, 0, 0>, 0.1, 22000, Stiff, Damp, true, <0.7,
0.7, 0.7>, <4, 4, 4>, Trans1, 3)
 }
        group {
   MechSim_Generate_Grid_Std(<0, 0, 0>, 0.1, 22000, Stiff, Damp, true, <0.7,
0.7, 0.7>, <4, 4, 4>, Trans2, 3)
 }
        group {
   MechSim_Generate_Grid_Std(<0, 0, 0>, 0.1, 22000, Stiff, Damp, true,
<0.55, 0.55, 0.55>, <9, 3, 3>, Trans3, 3)
 }
 save_file "blocks1.dat"
      }
    #end

  }
}



//MechSim_Show_All_Objects(-1, true, false, "")
MechSim_Show_Grid(0, 4,4,4, true, false, 0, "")
MechSim_Show_Grid(108, 4,4,4, true, false, 0, "")
MechSim_Show_Grid(216, 9, 3, 3, true, false, 0, "")


camera {
  location    <15, -10, 3.5>*1.4
  direction   y
  sky         z
  up          z
  right       (4/3)*x
  look_at     <0, 0, 0.>
  angle       30
}

light_source {
  <3.2, -0.3, 1.8>*100000
  color rgb <1.6, 1.5, 1.0>
}

sky_sphere {
  pigment {
    gradient z
    color_map {
      [0.00 rgb <0.8,0.9,1.0>]
      [0.10 rgb <0.6,0.7,1.0>]
      [0.25 rgb <0.2,0.3,0.8>]
    }
  }
}

//---------end of SDL
//---------end of SDL


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.