Write a program to model an exploding firecracker in the xy
plane using a particle system.



Write a program to model an exploding firecracker in the xy plane using a particle system...

Answer / Md Aurangzeb Khan

Here's an example implementation of Exploding Firecracker Particle System in Python using Pygame library:nn```pythonnimport pygamenpygame.init()nwin = pygame.display.set_mode((800, 600))ncolors = [[255, 0, 0], [255, 127, 0], [255, 255, 0], [0, 255, 0]]nnparticles = []nfor i in range(40):n particles.append([pygame.math.Vector2(600, 300), pygame.math.Vector2(-1, 0), colors[i % len(colors)]])nwhile True:n win.fill((0, 0, 0))n for p in particles:n p.velocity += pygame.math.Vector2(pygame.randrange(-5, 5) / 100, pygame.randrange(-5, 5) / 100)np.position += p.velocityn if (p.position.x < -50 or p.position.x > 750 or p.position.y < -50 or p.position.y > 650):n particles.remove(p)n else:n win.set_at(p.position.x, p.position.y, p[2])np.age += 1n if p.age > 100:n particles.remove(p)n pygame.display.flip()n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Image Processing Algorithms Interview Questions

Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange.

1 Answers  


how to count no of leaves in a tree?

1 Answers   Infosys,


What are the differences between Structural Patterns and Morphological Strutural Element?

1 Answers  


Set up procedure for generating a wire-frame display of a polyhedron with the hidden edges of the object drawn with dashed lines.

1 Answers  


Write a program to model an exploding firecracker in the xy plane using a particle system.

1 Answers  


Design an implement of the inputs functions for event mode.

1 Answers  


Derive expression for converting RGB color parameters to HSV values.

1 Answers   Verizon,


Develop a routine to reflect an object about an arbitrarily selected plane.

1 Answers  


determine performing two successive block transfer into the same area a frame buffer using the various boolean operation

0 Answers  


Write a procedure to implement highlight as a blinking operation.

1 Answers   Titan,


Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector.

1 Answers  


What is Rectification in image prosesing ?

1 Answers  


Categories
  • Image Processing General Interview Questions Image Processing General (144)
  • Image Processing Algorithms Interview Questions Image Processing Algorithms (20)
  • Image Processing AllOther Interview Questions Image Processing AllOther (6)