Task: Some Issues in the design of the Mangbetu project
Date: 0715-07281.
1. In the flash version of MG, the vector of the base shape has an initial angle of 90 degrees. So if the user input a starting angle of 45, the vector becomes 135. In today's meeting, Bill said from a math teacher's view, it is better to Not have the initial angle.
So shall we keep or remove this initial angle?
2. In the flash version of MG and CC, when we set the rotation degree as 45, the 1st image itself doesn't rotate but its vector do rotate. For all other images except the 1st one, both the images themselves and their vectors rotate 45. Shall we also make the 1st image rotate to have a consistent behavior?
3. In the 1st picture below, the 1st vector is Not reduced by 50%. It is because the image is duplicated before calling 'Translate by percent'. In the 2nd picture, the 1st vector is reduced by 50%. It's because I modified the implementation and let 'Translate by percent' deliberately changes the previous vector. This way looks nice, but the meaning of duplicated is not clear: the duplicated image will be changed by a later method calling.
Which way shall we take: the way in the 1st picture or the 2nd one?4. The order of the codelets
The 3rd picture is for showing 'Rotate before Translate' and Do Not change duplicated image.
The 4th picture is for showing 'Rotate before Translate' and Do change duplicated image.
So in our programmable version, the order of the codelets matters.
Wednesday, July 28, 2010
Start to do the Mangbetu project
Task: Start to do the Mangbetu project
Date: 0715-0728
The Mangbetu (MG) and Cornrow Curve (CC) have much in common. Their user interfaces of their flash versions look almost the same, except that Mangbetu supports 2 additional functionalities: Select Base Shape and Reflection per Iteration.
As a result, I can reuse the code of CC and just rename the classes for MG:
CC.Plait.java -> MG.Shape.java
CC.PlaitImage.java -> MG.ShapeImage.java
CC.CCUtil.java -> MG.MGUtil.java
I also had to support the additional functionalities of MG.
1. Select Base Shape
In MG, users can select from 6 base shapes with different properties.
So I add a property file MG.properties and MG will load the right properties when the user switch base shapes.
The properties of the base shapes are:
1.1 Image file
Changing image file is similar as that in CC: done by loading the corresponding resource file.
1.2 The shapes are not all square. So I add x_size and y_size parameters for specifying the size of the image in the x and y dimensions.
1.3 Default Color
1.4 Initial Vector Angle in Degree
1.5 Initial Image Angle in Degree
1.6 The anchor points of their vector are also different.
Shape Vector's Anchor
Diamond middle bottom
Side Face somewhere in left edge
Flange center
Triangle center Oval centerFace center
2. Reflection per Iteration
2.1Reflection the Image about X axis per Iteration is done by:
gl.glScalef( 1.0f, -1.0f, 1.0f);
Reflection the Image about Y axis per Iteration is done by:
gl.glScalef(-1.0f, 1.0f, 1.0f);Reflection the Image about X and Y axis per Iteration is done by:
gl.glScalef(-1.0f, -1.0f, 1.0f);
2.2The tricky part is that the computation of the image center from the vector's anchor, which is done according to the rule below. The red arrow is the vector that stands for the shift from the vector anchor to the image center. We call it shift vector.
2.3 To support rotation, we also need to rotate the shift vector accordingly.
3. Simple Demo
Parameter Setting:
Translate by percent: 50
Dilate by percent: 90
Reflection about Y axis
Date: 0715-0728
The Mangbetu (MG) and Cornrow Curve (CC) have much in common. Their user interfaces of their flash versions look almost the same, except that Mangbetu supports 2 additional functionalities: Select Base Shape and Reflection per Iteration.
As a result, I can reuse the code of CC and just rename the classes for MG:
CC.Plait.java -> MG.Shape.java
CC.PlaitImage.java -> MG.ShapeImage.java
CC.CCUtil.java -> MG.MGUtil.java
I also had to support the additional functionalities of MG.
1. Select Base Shape
In MG, users can select from 6 base shapes with different properties.
So I add a property file MG.properties and MG will load the right properties when the user switch base shapes.
The properties of the base shapes are:
1.1 Image file
Changing image file is similar as that in CC: done by loading the corresponding resource file.
1.2 The shapes are not all square. So I add x_size and y_size parameters for specifying the size of the image in the x and y dimensions.
1.3 Default Color
1.4 Initial Vector Angle in Degree
1.5 Initial Image Angle in Degree
1.6 The anchor points of their vector are also different.
Shape Vector's Anchor
Diamond middle bottom
Side Face somewhere in left edge
Flange center
Triangle center Oval centerFace center
2. Reflection per Iteration
2.1Reflection the Image about X axis per Iteration is done by:
gl.glScalef( 1.0f, -1.0f, 1.0f);
Reflection the Image about Y axis per Iteration is done by:
gl.glScalef(-1.0f, 1.0f, 1.0f);Reflection the Image about X and Y axis per Iteration is done by:
gl.glScalef(-1.0f, -1.0f, 1.0f);
2.2The tricky part is that the computation of the image center from the vector's anchor, which is done according to the rule below. The red arrow is the vector that stands for the shift from the vector anchor to the image center. We call it shift vector.
2.3 To support rotation, we also need to rotate the shift vector accordingly.
3. Simple Demo
Parameter Setting:
Translate by percent: 50
Dilate by percent: 90
Reflection about Y axis
Wednesday, July 14, 2010
Implement Plait as a PObject
Task: Implement Plait as a PObject
Date: 0701-0714.
In the previous Cornrow project, the main class is Curve, which is used to create the braids as dynamic objects. Curve is not a PObject and the PMethods are all of and in the CCEngine.
We need to modify the old design to make CC programmable.
The change: A new class Plait is added into CC.
1. Basic things about Plait
1.1 Plait is the composite unit of a braid. It is implemented as a PObject. So users can create a new plait by clicking 'create' in the menu, and created plaits will appear in the object panel.
1.2 Selecting a plait can be done in 2 ways: 1, click the plait on the draw panel. It is implemented in Plait.HitTest. 2, click the plait from the object panel. It is in Kernel.
1.3 About draw braids consisting of multiple plaits
I added a class: PlaitImage.The difference between Plait and PlaitImage is: Plait is a programmable object, users can get plait images by the PMethods it supports. In contrast, plait image is only a image for drawing. It is not a PObject.
2. PMethods in Plait
Currently, Plait has the following PMethods:
Duplicate
NextStep: the method for braiding
StartBraiding
GoToStartingAngle
Reflect
DilateByPercent
SetSize
TranslateByPercent
Rotate
SetColorSetImage: currently only take a String in the format of a '/'-separated path name that identifies the resource.
3. Things to be disscussed
3.1 StartBraiding VS GoTo, StartingAngle, + Reflect
Firstly, I added GoTo, StartingAngle, and Reflect for letting the users set up the starting parameters of a braid. But, then there is a problem: Reflect should be called as the last method for setting up the starting parameters. Orelse, reflection can't be done correctly. In the piecture below, the left braid is the original one, the right braid is the one got from reflection about the Y axis. The reflection is not correct, since when the reflection takes place the starting angle is the default 0, not the 90 degree later input by the user.It is possible to change the code to fix this. But which of the 3 ways should we have: only StartBraiding, only GoTo, StartingAngle, + Reflect, or both?
3.2 StartBraiding and Duplicate
Currently, StartBraiding only changes the position and angle of a plait. Users need to call duplicate to have the 1st plait image. Should we have StartBraiding do the duplicate itself?
4. Bug
When the application runs for a while, the texture of the plaits disappear.
Date: 0701-0714.
In the previous Cornrow project, the main class is Curve, which is used to create the braids as dynamic objects. Curve is not a PObject and the PMethods are all of and in the CCEngine.
We need to modify the old design to make CC programmable.
The change: A new class Plait is added into CC.
1. Basic things about Plait
1.1 Plait is the composite unit of a braid. It is implemented as a PObject. So users can create a new plait by clicking 'create' in the menu, and created plaits will appear in the object panel.
1.2 Selecting a plait can be done in 2 ways: 1, click the plait on the draw panel. It is implemented in Plait.HitTest. 2, click the plait from the object panel. It is in Kernel.
1.3 About draw braids consisting of multiple plaits
I added a class: PlaitImage.The difference between Plait and PlaitImage is: Plait is a programmable object, users can get plait images by the PMethods it supports. In contrast, plait image is only a image for drawing. It is not a PObject.
2. PMethods in Plait
Currently, Plait has the following PMethods:
Duplicate
NextStep: the method for braiding
StartBraiding
GoToStartingAngle
Reflect
DilateByPercent
SetSize
TranslateByPercent
Rotate
SetColorSetImage: currently only take a String in the format of a '/'-separated path name that identifies the resource.
3. Things to be disscussed
3.1 StartBraiding VS GoTo, StartingAngle, + Reflect
Firstly, I added GoTo, StartingAngle, and Reflect for letting the users set up the starting parameters of a braid. But, then there is a problem: Reflect should be called as the last method for setting up the starting parameters. Orelse, reflection can't be done correctly. In the piecture below, the left braid is the original one, the right braid is the one got from reflection about the Y axis. The reflection is not correct, since when the reflection takes place the starting angle is the default 0, not the 90 degree later input by the user.It is possible to change the code to fix this. But which of the 3 ways should we have: only StartBraiding, only GoTo, StartingAngle, + Reflect, or both?
3.2 StartBraiding and Duplicate
Currently, StartBraiding only changes the position and angle of a plait. Users need to call duplicate to have the 1st plait image. Should we have StartBraiding do the duplicate itself?
4. Bug
When the application runs for a while, the texture of the plaits disappear.
Thursday, July 1, 2010
Applet, Bug and Issue
Date: July 1
1. I updated the applet at: http://www.cs.rpi.edu/~wangp5/CC/CCAppletLaunCS.html
But the applet has a bug and a pending issue.
2. Bug
If the braids are loaded from a saved file, then after resizing the window the texture of the braids is lost. I will try to fix it within the next week.
3. Pending Issue
Prof. Moorthy and I did pair programming this morning. We discussed the issue of identifying multiple objects, specifically braids. We saw that in Scratch, users can select sprite in the right bottom panel. Jason has added such a panel, and in SB objects are shown in that panel.
But in CC, braids are not shown in the panel. It seems good if users can select braids to apply methods on in the panel. I will try to implement this with help from Jason and Shrikant within the next 2 weeks.
In Scratch, users can select sprite in the right bottom panel.
In SB objects are shown in the right bottom panel.
1. I updated the applet at: http://www.cs.rpi.edu/~wangp5/CC/CCAppletLaunCS.html
But the applet has a bug and a pending issue.
2. Bug
If the braids are loaded from a saved file, then after resizing the window the texture of the braids is lost. I will try to fix it within the next week.
3. Pending Issue
Prof. Moorthy and I did pair programming this morning. We discussed the issue of identifying multiple objects, specifically braids. We saw that in Scratch, users can select sprite in the right bottom panel. Jason has added such a panel, and in SB objects are shown in that panel.
But in CC, braids are not shown in the panel. It seems good if users can select braids to apply methods on in the panel. I will try to implement this with help from Jason and Shrikant within the next 2 weeks.
In Scratch, users can select sprite in the right bottom panel.
In SB objects are shown in the right bottom panel.
Subscribe to:
Posts (Atom)