November 17, 2024

Week 13 - Calls, special functions in Raptor

 CLASS OBJECTIVE

Know the Calls (special functions) in Raptor, to create graphic results such as geometry shapes, by opening a Graph Windows to draw different sizes circles, using loops.


INTRODUCTION

In Raptor we can create graphic results but, in order to do this you must learn how to use the Calls. A Call is a special function, previously programmed, that you can call (which is why the name).

There are plenty of Calls, but today we'll start with a couple of graphic Calls: 

  •  open_graph_window(width, height)
  • draw_circle(x_position, y_position, radius, color, filled)

You can compare Calls with the spreadsheet functions. To use them in Raptor you'll insert the Call symbol, then double click on it and you'll have to type the Call and its parameters.


For example, to open a graph window you would type:  

  • open_graph_window(300,500)
    • where 300 represent the window width 
    • and 500 represen the window height

Once you open a graph window, now you can draw on it, for example a circle:

  • draw_circle(150,250,80,red,0)
    • 150,250 represent the position of the circle´s center
    • 80 is the radius lenght
    • red is obviouly the color
    • 0 will be use to draw an unfilled circle and 1 to draw a filled circle.


ACTIVITY PART 1

Create the next Raptor program and try it.  Use the name Student number + graph window for the file.

  • Change the window size.
  • Change the color using english.
  • Change the circle´s center.
  • As you can see, the circle´s size depends on the user selection. 

Show your teacher the program and continue with the second part.



ACTIVITY PART 2
Now you'll change (or restart) the program to draw many circles usin a loop, as we learn in the last class. Use the next image to do it.

Once you finish, turn in the file using the Classroom post and continue with the class notes.


CLASS NOTES

Write down in your notebook the title of the class, the objective and follow the instructions.

  • Draw the last flowchart in your notebook, the one with the Loop. 
  • Describe, in your own words, what is the algorithm doing in every step indicated (numbers 1 to 6)


HOMEWORK

Research, using the Raptor official page (https://raptor.martincarlisle.com/docs/), the next graph drawing operations and tell, in your own words, how do they operate.
  1. OPEN GRAPH WINDOW
  2. DRAW CIRCLE
  3. DRAW LINE
  4. DRAW BOX
  5. FLOOD FILL