Render Part B Assignment
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
You will evolve your code from from Part A
superclass: Transform
NOTE: Be sure to not override render. Implement the render_transformed method instead.
ColorTransform
superclass: Transform
NOTE: Override render. Be sure to change the color before invoking your superclass.
Text
You will evolve your code from from Part A
superclass: ColorTransform
Add keyword parameters for x: 0, y: 0, and color: nil and invoke your superclass with these parameters.
NOTE: Be sure to not override render. Implement the render_transformed method instead.
Ellipse
You will evolve your code from from Part A
superclass: ColorTransform
NOTE: Be sure to not override render. Implement the render_transformed method instead.
EquilateralTriangle
You will evolve your code from from Part A
superclass: ColorTransform
NOTE: Be sure to not override render. Implement the render_transformed method instead.
BezierCurve
You will evolve your code from from Part A
superclass: ColorTransform
NOTE: Be sure to not override render. Implement the render_transformed method instead.
Chord
You will evolve your code from from Part A
superclass: ColorTransform
NOTE: Be sure to not override render. Implement the render_transformed method instead.
Rectangle
You will evolve your code from from Part A
superclass: ColorTransform
NOTE: Be sure to not override render. Implement the render_transformed method instead.
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