course name: programming mini-project 2 course name: programming mini-project 2 theme: computer...

29
Course Name: Course Name: Programming Mini- Programming Mini- project 2 project 2 Theme: Computer generated pictures Theme: Computer generated pictures of comets of comets http://cis.k.hosei.ac.jp/~vsavchen/ http://cis.k.hosei.ac.jp/~vsavchen/ MiniPr_2/ MiniPr_2/

Upload: gabriel-oconnor

Post on 18-Dec-2015

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Course Name:Course Name: Programming Programming Mini-project 2Mini-project 2

Theme: Computer generated Theme: Computer generated pictures of cometspictures of comets

http://cis.k.hosei.ac.jp/~vsavchen/MiniPr_2/http://cis.k.hosei.ac.jp/~vsavchen/MiniPr_2/

Page 2: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

IntroductionIntroduction One of the challenging problems of computer graphics (CG) and One of the challenging problems of computer graphics (CG) and

computer arts is the visualization of different natural phenomena computer arts is the visualization of different natural phenomena and simulated flow data. and simulated flow data.

Examples are clouds, space phenomena such as evaporation process Examples are clouds, space phenomena such as evaporation process of comet nucleus, mirages, rainbows, and other atmospheric effects.of comet nucleus, mirages, rainbows, and other atmospheric effects.

Visualization of simulated data can be useful in different Visualization of simulated data can be useful in different application areas to display behavior of studied phenomena or to application areas to display behavior of studied phenomena or to improve CG images with more correct scientific factors.improve CG images with more correct scientific factors.

Page 3: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

IntroductionIntroduction An example of evaporation process of comet nucleusAn example of evaporation process of comet nucleus One process which transfers water from the ground back to the atmosphere is

evaporation. Evaporation is when water passes from a liquid phase to a gas phase.

• The head of Comet Halley, May 1910. Photographed at Helwan The head of Comet Halley, May 1910. Photographed at Helwan Observatory, EgyptObservatory, Egypt

Page 4: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

IntroductionIntroduction Characteristics of a CometCharacteristics of a Comet• Structure

Nucleus Coma Dust tail Plasma tail

• Evaporation process When a comet approaches within a few AU of the

Sun, the surface of the nucleus begins to warm, and volatiles evaporate. The evaporated molecules boil off and carry small solid particles with them, forming the comet's coma of gas and dust.

Begins inside of Mar’s orbit

Generating coma and two tails

Page 5: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

IntroductionIntroduction

Modeling and Visualization of a Cometary Coma• To get the optical picture of a cometary coma, we can use To get the optical picture of a cometary coma, we can use

simple particle-based simulation, however, based on the main simple particle-based simulation, however, based on the main premises of the Whipple’s theory. premises of the Whipple’s theory.

• According to this theory the cometary nucleus is an icy According to this theory the cometary nucleus is an icy conglomerate of dust and meteor material. conglomerate of dust and meteor material.

• The icy particles evaporate on the surface exposed to the sun The icy particles evaporate on the surface exposed to the sun and carry off the dust particles accelerated by the solar and carry off the dust particles accelerated by the solar radiation.radiation.

• For more references, see,For more references, see,Whipple F. L. (1950) A comet model I. The acceleration of Comet Encke. Astrophys. J., 111, 375–394. Bschorr, O.; Jochim, E.F.; Freund, J. (1979) Bschorr, O.; Jochim, E.F.; Freund, J. (1979) ComputerComputer--GeneratedGenerated PicturesPictures of of CometsComets'. :l. '. :l. IAF-Congress, Amsterdam, 30 Sep-5 Oct 1974 IAF-Congress, Amsterdam, 30 Sep-5 Oct 1974

Page 6: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

IntroductionIntroduction

The optical picture of the coma and tail is The optical picture of the coma and tail is visualized by a Java Applet.visualized by a Java Applet.

Page 7: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Introduction.Introduction. Newtonian particle Newtonian particle systemssystems

A particle is described by its mass, m, and its A particle is described by its mass, m, and its trajectory, trajectory, rr(t), as illustrated in Figure(t), as illustrated in Figure

Newtonian particles are the most common Newtonian particles are the most common and are governed by Newton’s second lowand are governed by Newton’s second low

FF = m = mdd2rr((tt)/)/dtdt22,

where r(t) = [x1,x2,x3]T is the position of a particle at time t and a(t) = dd2rr((tt)/)/dtdt22 is the instantaneous acceleration of the particle.

Newton’s second law is converted into two coupled first-order differential equations where a point p R6 in phase space is denoted by its position r and velocity v = ddrr((tt)/)/dtdt

Page 8: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the Cometary Coma

Overview of the Modeling and Visualization of Comets Applet

Comet\Cometaimage2.htmlComet\Cometaimage2.html Structure of the AppletStructure of the Applet Input parametersInput parameters

Page 9: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the Cometary Coma

Coordinate systems The heliocentric system o The motion of the cometary nucleus

and particles is described in the heliocentric Cartesian coordinate system r(x,y,z) related to the orbital plane of the comet.

o The coordinate x is directed from the sun to the cometary

nucleus, y is lying in the orbital plane, z is perpendicular to the orbital plane.

Page 10: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the Cometary Coma

Coordinate systems Image coordinates

o If the heliocentric coordinates rb of the observer and rk of the comet are given, the parallel or central projection of a particle with the heliocentric coordinates rp can be calculated.

o The parallel projection of a particle with heliocentric position vector rp has the image position vector

r*p = (rb – rk)[ (rb – rk) (rp – rk)]/ rb – rk2

o The central projection of a particle with heliocentric position vector rp has the image position vector

r*p = (rb – rk)[ (rb – rk) (rp – rk)]/ ((rb – rk) (rp – rb))

Page 11: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the Cometary Coma

Coordinate systems Image coordinateso The parallel projection

o The central projection -A mapping of a configuration into a plane that associates with any point of the configuration

Page 12: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the Cometary Coma

World window – a rectangular region in World window – a rectangular region in the world that is to be displayed the world that is to be displayed

Define by

W_L, W_R, W_B, W_T

W_L W_R

W_B

W_T

Page 13: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the Cometary Coma

ViewportViewport• The rectangular region in the screen for The rectangular region in the screen for

displaying the graphical objects defined in the displaying the graphical objects defined in the world windowworld window

• Defined in the screen coordinate system Defined in the screen coordinate system

V_L V_R

V_B

V_T

Page 14: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 1. Modeling and Visualization of the

Cometary Coma

1.1. Develop functions of scalar dot() and vector Develop functions of scalar dot() and vector multiplications multiplications vec_m()vec_m()..

2.2. Develop functions for calculating the parallel and central Develop functions for calculating the parallel and central positions of the image position vector.positions of the image position vector.

3.3. Develop Window to Viewport supporting classDevelop Window to Viewport supporting class

4.4. Use a driver program shown in Use a driver program shown in Listing1Listing1 (download zip (download zip

file)file) as an example of a future Applet. as an example of a future Applet.

5.5. Naturally, you can use your own driver programNaturally, you can use your own driver program!!

Page 15: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the Cometary Coma

Coordinate systems The comet centered systemo We assume the nucleus as a sphere which is covered

by a meridian system (, ) .o The north pole of this system is normally directed to

the sun.o The latitude is measured from the north pole

toward the equator.o The longitude is characterized by the angle .o There are kG intervals on the latitude circle and lG

intervals on the longitude circle.o Each of these intervals is numbered by k and l resp.

Page 16: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the Cometary Coma

The cometary model The evaporation process – regular evaporationo The cometary material accelerated from the sun and forming the

coma and tail is composed of different i classes of particleso The evaporation process is divided into time intervals t, which are

numbered by the index j: tj. o The surface of the nucleus is divided into elementary areas kl

kl ~sin k . o The number of particles nijkl of class i evaporated from surface

element kl in the unit time is related to ~cos kkl and directly proportional to the relative evaporation rate of the given particle class.

Page 17: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the Cometary Coma

The cometary model The evaporation process – regular evaporationo The number (particle lump) is calculated by

nijkl = Ai cos k kl tj/r2, if cos k < 0,

where r is the heliocentric distance of the nucleus and Ai is the evaporation rate of particle class i.

o The position vector ri of the particle lump is set equal to the position vector rk of the nucleus in the moment of the beginning of the evaporation process.

Page 18: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the Cometary Coma

The cometary model Influence due to rotation of the nucleuso The nucleus of a comet has a diameter of about 1 to 100 km and in

the general case has rotation that causes the surface temperature deviation.

o The rotational axis may be oriented in any direction. The temperature deviation can be approximated by a shift of the meridian system (, ) covering the nucleus such that its north pole points away from the sun by the angle 0.

o The latitude is measured from the north pole toward the equator and the north pole is directed to the sun, is the longitude.

Page 19: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the Cometary Coma

The cometary model Influence due to rotation of the nucleuso The state vector of the particle lump nijkl at the end of expansion

phase (occurred after the evaporation) is ri and vi

ri = rk + i ,

vi = vk + wi .

rk is the position vector of the nucleus, vk its velocity vector.

The vectors i and wi are normal to the surface.

Page 20: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the Cometary Coma

The cometary model Influence due to rotation of the nucleuso Let ekl the direction vector in our coordinate system. Then

i = i ekl, wi = wi ekl,

where

i is the boundary of the zone of expansion for the particle class i and wi is its individual final velocity.

Page 21: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 2. Modeling and Visualization of the

Cometary Coma

1.1. Develop functions needed for simulation Develop functions needed for simulation regular evaporation.regular evaporation.

2.2. Use a driver program shown in Use a driver program shown in Listing1Listing1 as as an example of a future Applet. an example of a future Applet.

Page 22: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 3. Modeling and Visualization of the Cometary Coma

Phase of free flying cometray particles (the particle bundle)o The state vector of the particle bundle at the end of the expansion phase is r0 , v0 .o If we know the boundary of the expansion zone , the final thermal velocity

w, and the repulsive factor f, after the expansion phase the motion of the given particle bundle is calculated by the cubic approximation as follows:

r(t) = [1- f t2/2r03 + ft3/2r0

5(r0v0)]r0 + (t - f t3/6r03 )v0,

v(t) = [- f t/r03 + 3 f t2/2r05(r0v0)]r0 + (1 - f t2/2r0

3 )v0. This system of equations is implication of the difference equation

d2r/dt2 + f r/r3 = 0 and Taylor’s expansion of r(t).

- heliocentric gravitational constant.

Page 23: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 3. Modeling and Visualization of the Cometary Coma

The motion of a comet and an observer (the Earth)o Comets and planets necessarily obey the same physical laws as every other

object. o They move according to the basic laws of motion and of universal

gravitation discovered by Newton in the 17th century (ignoring very small relativistic corrections). If one considers only two bodies -- either the Sun and a planet, or the Sun and a comet -- the smaller body appears to follow an elliptical path or orbit about the Sun, which is at one focus of the ellipse.

o Nevertheless, comets are the perfect examples both of large perturbations Nevertheless, comets are the perfect examples both of large perturbations and their possible consequences. Comets expel dust and gas, usually from and their possible consequences. Comets expel dust and gas, usually from localized regions, on the sunward side of the nucleus. This action causes a localized regions, on the sunward side of the nucleus. This action causes a reaction by the cometary nucleus, slightly speeding it up or slowing it down. reaction by the cometary nucleus, slightly speeding it up or slowing it down.

o For simplicity, we define the comet and observer motion by numerical For simplicity, we define the comet and observer motion by numerical integration of the integration of the difference equation

d2r/dt2 + r/r3 = 0

Page 24: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 3. Modeling and Visualization of the Cometary Coma

The Runge-Kutta algorithm o Consider the  initial value problem yy = = ff((x,yx,y) with ) with yy((xx0) = ) = yy0 over the interval over the interval aa xx bb..o The Runge-Kutta method iterates the The Runge-Kutta method iterates the xx-values by simply adding a fixed step-size of -values by simply adding a fixed step-size of hh at at

each iteration. each iteration. o Here is a summary of the method:Here is a summary of the method:

xxn+1 =  = xxn +  + h

yyn+1 =  = yyn + (1/6)( + (1/6)(kk1 + 2 + 2kk2+ 2+ 2kk3 +  + kk4) )

where where

kk1 =  = hh  ff((xxn, , yyn) )

kk2 =  = hh  ff((xxn +  + hh/2, /2, yyn +  + kk1/2) /2)

kk3 =  = hh  ff((xxn +  + hh/2, /2, yyn +  + kk2/2) /2)

kk4 =  = hh  ff((xxn +  + hh, , yyn +  + kk3))

Page 25: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 3. Modeling and Visualization of the

Cometary Coma

1.1. Develop a function needed for simulating Develop a function needed for simulating free flying cometray particles..

2.2. Develop a function for numerical integration of the Develop a function for numerical integration of the difference equation, for example, use the common fourth-order Runge–Kutta method

3.3. Use a driver program shown in Use a driver program shown in Listing1Listing1 as an example as an example of a future Applet. of a future Applet.

Page 26: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 4. Modeling and Visualization of the Cometary Coma

Presentation of the imageso We know the position vector r for each particle lump nijkl of class

i originated at time tj, j = 1,2, 3,…, N. N is the number of time intervals defined by the user.

o The number nijkl is used as a measure of brightness Hijkl and is directly proportional to the light emission Di of particles of the class i.

o The superposition of all brightness elements yields an image of the cometary tail.

Page 27: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 4. Modeling and Visualization of the Cometary Coma

Presentation of imageso For obtaining a well illuminated image we seek the brightest and

the darkest point in the image.o This range of brightness will be divided into 255 brightness steps

(levels). Figure (a) shows that the straightforward approach to draw a flow of tiny particles cannot

provide a realistic picture. Figure (b) presents the picture with smoothed data approximated by an algorithm. o Simplest way is to use the mean filter - a simple sliding-window spatial filter that

replaces the center value in the window, for instance, 3x3 pixels with the average value of its neighbors.

Page 28: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 4. Modeling and Visualization of the

Cometary Coma

1.1. Develop functions which are necessary for Develop functions which are necessary for visualization.visualization.

2.2. Finish development of the Applet. Finish development of the Applet.

Page 29: Course Name: Programming Mini-project 2 Course Name: Programming Mini-project 2 Theme: Computer generated pictures of comets Theme: Computer generated

Step 5. Modeling and Visualization of the

Cometary Coma

Applet’s presentation Applet’s presentation