Difference between revisions of "Render Part B Assignment"
Line 11: | Line 11: | ||
superclass: Object | superclass: Object | ||
+ | |||
+ | Transform's constructor should take x and y parameters and store them in instance variables. | ||
+ | |||
+ | It should define a render method which [https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glPushMatrix.xml preserves the current model view transformation], [https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml translates in the z==0 plane], passes the render_transformed message to itself, and [https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glPopMatrix.xml restores the model view transformation]. | ||
+ | |||
+ | All subclasses must implement a private render_transformed method. | ||
==Image== | ==Image== |
Revision as of 07:28, 15 July 2019
In this studio we will evolve our code from Render_Part_A_Assignment to leverage class hierarchies.
File:Part b class hierarchy.png
Continue editing files in the render/assignment directory.
In this studio, we will have parameters for which explicitly passed arguments are not required (for convenience and backwards compatibility). We will prefer keyword arguments over optional arguments.
Contents
Code to Implement
Transform
superclass: Object
Transform's constructor should take x and y parameters and store them in instance variables.
It should define a render method which preserves the current model view transformation, translates in the z==0 plane, passes the render_transformed message to itself, and restores the model view transformation.
All subclasses must implement a private render_transformed method.
Image
superclass: Transform
ColorTransform
superclass: Transform
Text
superclass: ColorTransform
Ellipse
superclass: ColorTransform
EquilateralTriangle
superclass: ColorTransform
BezierCurve
superclass: ColorTransform
Chord
superclass: ColorTransform
Rectangle
superclass: ColorTransform
CompositeTransform
superclass: Transform
class Scene
superclass: Object
Testing Your Solution
Unit Testing
ruby/render/part_b_test/part_b_unit_test.rb
Visual Comparison
ruby/render/part_b_test/part_b_test_snapshots_web_page_generator.rb