Peter Lorenz German smaller fonts Simulation und Animation

2.2.3. Class Mode

P3D Classes might inlude objects of other Classes. Pathes for moving objects can be placed within a Class.

Toolbar

This is the Toolbar of the Class Mode:

Toolbar

New is here the PC-button for defining a Path within the Class. The last three Buttons are new compared to Proof 2D, too: Obviously it is possible to use

as well for constructing a Class. Defining a new Class begins by pressing the button. Then the Class Name box is opened:

After pressing the OK button the Class definition box appears. Here we show this box with the tabs General and Z-distortion. The General menu is well known from Proof 2D. The new Z-Distortion tab allows a different scaling of the object depending on the distance from the Camera.

For construction a Class Bike the XZ-plane has to be selected if the bike should move in the XY-plane. Now the frame of the bike is drawn as a PolyLine in the Pipe mode.
Now we need 1 saddle, 3 forks, 2 wheels, 1 crank with pedals, 1 handlebar and something more.

Objects in Classes

Objects or instances of Classes can be included in a Class as inner objects. That can be started by pressing the button Inner Object. The New Inner Object Name box is opened and a name for the inner object has to be typed.

Of course the Class of the inner object has to be constructed in advance.

Continuing the Bike example a Class Fork has to be constructed. Let us assume that the wheels of our bike have a diameter of 0.33m. Then the fork needs a width of at least 0.35 m. For constructing such a fork we select the XY-plane. The class Fork has 2 PolyLines as Pipes. Defining a radius > 0 is important for avoiding discontinuities on inner Vertexes.
Now the Forks can become inner objects of the Class Bike. After pressing the button Inner Object the name F1 has been typed, the Class Fork has been selected and placed on a suitable position. Usually the inserted inner Object has to be transformed. In the Edit Layout Object box the Location of the Object can be edited and the Object ca be transformed. The tab Transform offers the four options Roll, Pitch, Yaw and Scale.
The Fork Object F1 lies in the XY plane until it is pitched (rotated around the Y-axis) by -64 degrees. It is scaled by the factor 1.54 because the original is too small.
The next pictures shows the Bike frame with three Forks.

Proof 3D provides rotation around all three axes.

An object can undergo roll, pitch and yaw simultaneously.

In the next section the import of 3D object as meshs has to be explained. Instead of constructing a Bicycle frame using the drawing tools of P3D a complete import of a bicycle frame as 3D object would be an alternative solution. A first advantage of our self made construction is the very small size of the layout file Bike2.lay. It has a size of 1664 Bytes. We will compare it with the size of imported meshs in the next section. A second advantage is the readablility and the option to write or modify it. Here is a copy of this file:

*3D
Define View "(Home)" CameraSphere -0.469958 0 0 1.879829 0 89.999998 0 
	Lighting -0.1924 -0.1924 -0.9622 Ambient 0.4 0.4 0.4 Grid Size 0.02 0.2 Menu ON Speed 6
Define View "Bike1" CameraSphere -0.0000011848 0 0 1.879829 39.999928 33.999929 0 
	Lighting -0.1924 -0.1924 -0.9622 Ambient 0.4 0.4 0.4 Grid Size 0.02 0.2
Define Mesh Wheel "WheelXGGalery.x" Scale 1.3 1.3 0.6 Rotation 0 0 90 Color F2
Color F2
Define Class Fork Camera  0 0.0000000204 0.466175 0.466175 1.570796 1.570796 0 Directional
Line  #1 0 0 0 0.06 0 0
Line  #2 0.06 0 0 0.097476 0.037476 0
Arc  #3 0.01 0.104547 0.030405 0 135.000092 95.710564 normal 0 -0 1
Line  #4 0.103552 0.040355 0 0.4 0.07 0
Line  #5 0.06 0 0 0.097475 -0.037475 0
Arc  #6 0.01 0.104546 -0.030404 0 315.000122 275.710724 normal -0 -0 -1
Line  #7 0.103551 -0.040354 0 0.4 -0.07 0
PolyLine Pipe 0.02
#1
#2
#3
#4
End
PolyLine Pipe 0.02
#5
#6
#7
End
End
Define Class Bike Camera  -0.0000037668 -3.399416 -0.0000005134 3.399415 0 1.570796 0 Directional
Arc  #8 0.01 -0.396666 0 0.79 28.072636 -90 normal 0 1 0
Arc  #9 0.01 -0.699403 0 0.222369 154.983032 28.072332 normal 0 1 0
Line  #10 -0.690579 0 0.217663 -0.387842 0 0.785294
Line  #11 -0.97336 0 0.785771 -0.708465 0 0.21814
Line  #12 -0.396666 0 0.8 -0.964298 0 0.8
Arc  #13 0.01 -0.964298 0 0.79 270 154.982864 normal 0 1 0
CPO Fork F1 -0.417822 -0.0000009537 0.886989 Color F2 Pitch -64 Scale 1.54 1.54 1.54
CPO Fork F2 -0.964298 0 0.8 Color F2 Pitch -120 Scale 1.4 1.4 1.4
CPO Fork F3 -0.708465 0 0.21814 Color F2 Pitch 168 Scale 1.4 1.4 1.4
PolyLine Pipe 0.03
#13
#11
#9
#10
#8
#12
Close
End
CPO Bike B1 0 0 0 Color F2
End

Meshs in Classes

In the former section the Define Mesh command has been introduced. Here we present some examples for importing Meshs. All 3D models habe been found in Google's 3D-galerie.

Searching for bicycle you'll find more than 850 entries (11/03). The following steps are recommended:
  1. Select a model with suitable parts
  2. Open it with Google's Sketchup
  3. Select the desired part (wheel, saddle, pedal, ...) and delete all remaining parts
  4. Move the selected part to the origin of the coordinate system
  5. Turn the selected part in the desired direction
  6. Save the Sketchup model containing only the selected part
  7. Export it to .x using the 3DRad Plugin
Now the .x file can be imported by P3D as a new Mesh.
The picture one the right hand shows how the Class Wheel is defined based on the Mesh Wheel. In the next picture two objects of the Class Wheel have been placed in the frame of the bicycle. They have got the names W1 and W2. The Layout file Bike3.lay and the .x file of a wheel can be downloaded. The 7 steps have been executed for some other parts (Crank, Saddle, Handlebar) of the bicycle. On the right hand you can see a bicycle with these parts saved as Bike4.lay. Now we can write an atf with the following content:
set viewing_speed 1
time 5
pitch B1:P speed -60
time 10
pitch B1:W1 speed -155
time 10
pitch B1:W2 speed -155

time 20
move B1 speed 1 20 0 0 relative
time 30
set view PathView
place B1 on BikePath
time 200 
end
* Wheel radius: 0.37
* Wheel circumference: 0.37*2*3.1416 = 2.32 m
* Speed = 1m/s
* Rotation angle per second = 360*1/2.32= 155 degrees per second



Paths in Classes

As just demonstrated a P3D Class may contain Objects of other Classes. Subsequently it is desirable to move them on Class owned Paths. A Path can be definid during a Class definition by Pressing the button. As usual Lines and Arcs for the Path have to be defined in advance.

Returning to the bicycle we can see a deficiency in the motion of the pedals of the bicycle. They should be squeezed to stay in a horizontal orientation during the circular motion of the crank. That can be done in the following steps:
  1. Remove the pedals from the 3D model of the crank
  2. Separate a pedal from the old crank and save it as 3D model
  3. Transform the new crank and the pedal model in the .x format
  4. Import them as P3D Meshs
  5. Define new Classes Crank and Pedal (non directional)
  6. Draw Arcs (full circle) for the motion of the Pedals
  7. Press the button and define circular Paths R(Right) and L(Left)
  8. Create two Pedal objects and place them on these Paths.
  9. Calculate and set travel values for the Pedal objects.
Here is the atf for the animation presented below:
set viewing_speed 1
time 2
pitch B1:C speed -60
place B1:PL on B1:L
set B1:PL travel 6
place B1:PR on B1:R at 0.565
set B1:PR travel 3
time 10
pitch B1:W1 speed -155
pitch B1:W2 speed -155
time 20
move B1 speed 1 20 0 0 relative
time 30
set view PathView
place B1 on BikePath
time 200 
end
* The Crank has the speed 60.
* It needs 360/60 = 6 seconds for a complete rotation.
* Therefore we have to specify  time = 6 for moving on the Paths L and R
* On the Path B1:L the Pedal should be placed on the starting Point  
* + 3.14* radius 0.18 = 0.565 and get the half travel time = 3

Quizzes

  1. Explain the enhancements of P3D Classes comparing them to P5 Classes!
  2. Which attributes have P3D Classes?
  3. How Objects in Classes are identified in P3D .lay and .atf files?
  4. How 3D models should be prepared for importing and using them in P3D Classes?
  5. How imported Meshs can be adapted for using them in P3D models?

Navigation

SAHome previous next up Germansmaller fonts Top Line
Last Modified Fri 05-27-11 06:54 GMT Valid CSS!
English Translation:PL

Comments please to:pelosim@yahoo.com