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 |
Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange.
how to count no of leaves in a tree?
What are the differences between Structural Patterns and Morphological Strutural Element?
Set up procedure for generating a wire-frame display of a polyhedron with the hidden edges of the object drawn with dashed lines.
Write a program to model an exploding firecracker in the xy plane using a particle system.
Design an implement of the inputs functions for event mode.
Derive expression for converting RGB color parameters to HSV values.
Develop a routine to reflect an object about an arbitrarily selected plane.
determine performing two successive block transfer into the same area a frame buffer using the various boolean operation
Write a procedure to implement highlight as a blinking operation.
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.
What is Rectification in image prosesing ?