1 / 17

Physical Simulation Language : P S L

Physical Simulation Language : P S L. John Hamer John Rodriguez Danian Martinez Taino Ortiz hamer jr534 djm188 tjo22. Background Info.

Download Presentation

Physical Simulation Language : P S L

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Physical Simulation Language:PSL John Hamer John Rodriguez Danian Martinez Taino Ortiz hamer jr534 djm188 tjo22

  2. Background Info • PSL is a language intended for the convenient analysis of motion and objects in a 2D space. • Other languages, such as Direct X, make even the simplest simulation a bother. • Window management issues • Efficient memory handling, message queueing

  3. Purpose • PSL was created for two reasons: • To facilitate the creation of simple polygonal shapes using a simple language. • To feature interaction among these objects for the demonstration of physical principles.

  4. Key Features • Key Features of PSL • Graphical Display • Immediate response to what he programmed in PSL • Collision Detection and Reaction • Attempts to simulate how real world objects handle collisions in the environment • Slightly costly • O(n2) algorithm

  5. PSL Data Flow This diagram shows the process a .PSL file is put through to become an executable

  6. Compiler • ANTLR v2.7.2 was used to develop PslParser and PslLexer via our language-specific CFG • We decided to implement our own treewalker, which assisted ANTLR in performing semantic analysis of the resultant ASTs

  7. PSL Objects • Possible objects in PSL • Circle • Circle(double center_x, double center_y, double radius) • Rectangle • Rectangle(double x, double y, double length, double width) • Square • Square(double x, double y, double length) • Polygon – convex AND concave • Poly(double x1, double y1, double x2, double y2) • Line • Line(double x1, double y1, double x2, double y2)

  8. Abstract Syntax Tree • Each statement is composed of a subtree known as a child with the first token as the root and all proceeding tokens its children • Value list become children of the Object that is being created of altered. • The AST that ANTLR generates is read as a list and using the API provided by their AST files they are processed one child at a time.

  9. Intermediate Code Generator • Takes in • One vector of all objects • All global variables defined • Abides by PSL-specific C++ template to generate appropriate environment and object specifications • Writes the corresponding C++ source file • PSL “bytecode” 

  10. Backend • Graphics programming already has a commonly-used API – OpenGL! • Often complicated and error prone • Complicates the simplest demo • Not for rookies… • PSL implements its powerful capabilities while eliminating the learning curve

  11. Backend (continued) • The backend of the PSL language implemented a carefully structured OO environment using C++/OpenGL • PslEnvironment = the rendering environment • PslPolygon, PslSquare, etc… • For windowing, the GLUT toolkit was used on Windows XP, Mesa on Redhat Linux. • Set using PSL Global setter methods

  12. Design of Backend

  13. Simple.psl def circle1 Circle(3, 3, 3);//Creates a circle circle1.color(255, 0, 0);//Sets color to red circle1.points(20); def poly1 Polygon(-5, -5, 3, -5);//Creats a square Poly1.addpoint(-2.5, -2.5) poly.color(0, 0, 255);//Sets color to blue Global.zoom(15);//Set the camera zoom /* Sets window size */ Global.windowSize(300, 300);

  14. Simple.psx

  15. Testing Plan • Modular Testing • Tested each module before integrating • Regression Testing • Tested new modules to verify that they worked with the other modules • Integration Testing • Integration of front and Backend • This Test verified that the language worked • Error Testing • Used to verify that the compiler threw errors for incorrect syntax and/or semantics

  16. Conclusion • PSL is a valuable asset • To the graphics designer, executive, or engineer who must incorporate graphical displays into their everyday assignments. • A lecture given by a high school physics professor will be much more effective with PSL-designed presentations in his or her arsenal.

  17. Lessons • Three very important properties of a good team • Trust • Communication • Commitment

More Related