The remaining vis are concerned with drawing, as such we found it convenient to define a colour palate that could be changed in one place, to completely change the colour scheme used. In order to achieve this we defined a .ctl file as shown below.
Figure 42
Colour | Description |
Back Ground
|
The colour to use for the back, or greyed out, section of the prism
|
Regular colour
|
The colour to use for a prism sitting “idle” with no control points selected and the mouse not over any active part of the prism
|
Active colour
|
The colour to use when the prism is being manipulated, eg translated, rotated etc, i.e. the mouse is down over an active control point
|
Centre Point
|
The colour to use for the geometric centre of the prism
|
Control Point
|
The colour to use for the inner part of the control point
|
Outline of Control Point
|
The colour to use for the outer ring of the control point
|
Translation Lines
|
The colour to make the translation lines
|
Selected colour
|
The colour to use when the prism has been highlighted by placing the mouse over the top either the geometric centre of a prism or one of its control points.
|
Figure 43
This vi draws an active prism, this is defined as being a prism that can have a possible 3 colours, has control points and has translation lines, however the control points and translation lines are drawn by other vis.
Inputs
|
Type
|
Description
|
mouseDown?
|
Boolean
|
Is the mouse down over a control point? Changes the prism colour if true.
|
Picture in
|
Picture control
|
The picture to draw the prism on to
|
2D Rectangular Prism
|
Cluster of 8 2D points each 2D point is a cluster of 2 integers
|
The RP to draw
|
Colours for Drawing
|
Cluster of 8 colour controls
|
The colour palate described above
|
isOverControlPoint
|
Boolean
|
Is the mouse over a control point but not down? Brings about a colour change when true
|
Y picture height
|
integer
|
The number of pixels the input picture has in its y (vertical) direction.
|
Outputs
|
Type
|
Description
|
Picture out
|
Picture control
|
The new picture with the RP drawn on it, including greying of back lines.
|
Figure 44
This vi draws a non active 2D prism, including greying of back lines. The prism can have a total of 2 colours, controlled by the “Selected” Boolean input
Inputs
|
Type
|
Description
|
Y picture height
|
Integer
|
The number of pixels the input picture has in its y (vertical) direction.
|
Picture in
|
Picture control
|
The picture to draw the prism on to
|
2D Rectangular Prism
|
Cluster of 8 2D points each 2D point is a cluster of 2
|
The RP to draw
|
Colours for drawing
|
Cluster of 8 colour controls
|
The colour palate described above
|
Selected
|
Boolean
|
Is the mouse over the top of the geometric centre of the prism? If true changes the colour from “regular” to “selected”.
|
Outputs
|
Type
|
Description
|
Picture out
|
Picture control
|
The new picture with the RP drawn on it, including greying of back lines.
|
Figure 45
This draws the translation lines for an active RP.
Inputs
|
Type
|
Description
|
Colours for drawing
|
Cluster of 8 colour controls
|
The colour palate described above
|
Bottom Centre
|
Cluster of 2 integers
|
This is the intersection point of the two lines. For an active prism this is found from looking at the bottom centre point in the control points cluster
|
Picture in
|
Picture control
|
The picture to draw the translation lines on to
|
Workspace
|
Cluster of 4 2D points, each 2D points is a cluster of 2 integers
|
This comes from the calibration section, it defines the grid corners
|
Mean Gradiant of Horizontals
|
Double
|
This is defined as an output from calibration
|
Y picture height
|
Integer
|
The number of pixels the input picture has in its y (vertical) direction.
|
Vanishing Point
|
Cluster of 2 integers
|
The 2D vanishing point of the picture
|
Outputs
|
Type
|
Description
|
Picture out
|
Picture control
|
The new picture with the translation lines drawn on it.
|
Figure 46
This vi draws the control points of a 2D prism, they are drawn as discussed in section 6.2.7.2 above.
Inputs
|
Type
|
Description
|
Y picture height
|
Integer
|
The number of pixels the input picture has in its y (vertical) direction.
|
Picture in
|
Picture control
|
The picture to draw the control points on to
|
Control Points
|
Cluster of 5 2D points, each 2D points is a cluster of 2 integers
|
The control points that are to be drawn, the bottom centre control point is not drawn as the bottom centre is indicated by the intersection of the translation lines, and the presence of the control point as well was destroying some of the perspective.
|
Radius
|
integer
|
The radius to draw the control points, measured in pixels, as discussed in section 6.3.1 a good radius is around 3.
|
Colours for drawing
|
Cluster of 8 colour controls
|
The colour palate described above
|
Outputs
|
Type
|
Description
|
Picture out
|
Picture control
|
The new picture with the control points drawn on it.
|
Module 7: Cursors 7.1Initial Specification
The action performed or about to be performed by a mouse click needs to be conveyed to the user through the use of cursors other than the standard labView cursor, the hand. These cursors should become active when over control points, control points are discussed in module 6 AR graphics. The cursors should indicate the use of the control point, so if the mouse is over a rotation control point then something to do with rotation should be shown.
7.2 Design and Implementation
7.2.1 Cursor Types
A number of different cursors are needed to be able too meet the specification. There needs to be cursors for each different type of control point as well as a general cursor. In addition we also created cursors that differ slightly between when the mouse is up to when the mouse is down. We called these cursors passive and active cursors respectively, and their pictures differ in file name by the presence of a capital A at the end.
7.2.1.1 Select Cursor
Figure 47
This cursor is used when a prism wire frame has the mouse over the geometric centre to indicate that the RP wire frame under the cursor will become selected if the mouse is clicked. There is no active version of this cursor
7.2.1.2 Rotate Cursor
Figure 48
This cursor is used to when a rotation point is highlighted and selected
7.2.1.3 X & Y position cursor
Figure 49
This cursor is used when the RPs bottom centre control point is selected or highlighted, it indicates translation in the x & y dimensions simultaneously
7.2.1.4 Directional Manipulation
There are a number of arrows that are used to indicate both translation and stretching. However, due to the limited nature of the cursors, they do not rotate in every direction imaginable, just horizontal, vertical and 45 degree diagonal in both directions (see below), there is a need to be to ale to determine which directional arrow to use based on the situation.
Height is simple, as it will always stretch vertically up we use the updown arrow.
Translation lines are also simple, as they will only use the horizontal and vertical arrows depending on the direction of translation.
But the length and width control points will used varied cursors depending upon the orientation of the RP wire frame. The simple way to determine which cursor to use is to look at the control points in 2D. We then need to calculate the angle that the line adjoining the control point of interest and the rotation control point, makes with the horizontal (x) axis. We call this angle .
For:
and use cursor: leftright
use cursor: TRBL
use cursor: updown
use cursor: TRBL
Where is measured as shown below.
Figure 50
And the cursors are defined as follows.
Figure 51
Note: that TLBR is an abbreviation for top left bottom right, and TRBL is an abbreviation for top right bottom left, which refer to the direction that the corners that the cursor extends from and to.
7.3 Testing
The code which changes the cursor was taken off the Internet from the National instruments web site, it is supported and tested by National Instruments Applications Engineers. The code is available from http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E79356A4E034080020E74861&p_node=DZ53008&p_submitted=N&p_rank=&p_answer=&p_source=External . We still tested this code to see that the cursors were indeed being changed, and being changed to the correct picture. We did this via a testing vi which is included in the software produced for this project, it is unfortunate that the results cannot be reproduced here but screenshots under windows do not capture the mouse position or appearance.
As such the only code that required extensive testing by us was the code that determines the angle between the rotation point and the control point of interest. Here are some of the results:
Point 1
|
Point 2
|
Expected angle (degrees)
|
Actual angle (degrees)
|
Passed?
|
(0,0)
|
(10,0)
|
0
|
180
|
*
|
(0,0)
|
(7,3)
|
32.2
|
23.2
|
Yes
|
(0,0)
|
(9,5)
|
29.1
|
29.1
|
Yes
|
(0,0)
|
(7,7)
|
45
|
45
|
Yes
|
(0,0)
|
(5,9)
|
60.9
|
60.9
|
Yes
|
(0,0)
|
(3,10)
|
73.3
|
73.3
|
Yes
|
(0,0)
|
(0,10)
|
90
|
90
|
Yes
|
(0,0)
|
(-9,5)
|
151
|
151
|
Yes
|
(0,0)
|
(-10,0)
|
180
|
0
|
*
|
(0,0)
|
(-10,10)
|
45
|
45
|
Yes
|
* Note: for the purposes of assigning cursors and also as far as a horizontal line is concerned then 0deg and 180 deg are equivalent.
7.4 Future Work
We have implemented the cursors using discrete positions, and with a very course resolution,6 per . It would be nice to increase this resolution or to find some way of having a continuous, or at least continuous appearing, way of defining the cursors based the orientation of the prism.
We have also grouped the actions of translating and stretching the prism into the same categories using the same cursors for each action. A different cursor to indicate the different actions would be desirable, we attempted to implement this but were not able to come up with a meaningful representation to distinguish between the two actions in the time.
7.5 Final Specification
The only design change is that mentioned above in Future Work, which was that we didn’t distinguish between the different actions of translation and scaling. This is however, a minor design change and doesn’t appear to affect the usability of the system at all.
Share with your friends: |