bb
mxyc −=
or
ee
mxyc −
(18)
Critical point calculation starts with finding the
intersection point (
tioner
x
secint
,
tioner
y
secint
) of any two
lines having line parameters
1
m
,
1
c
,
2
m
and
2
c
.
21
1221
secint
mm
cmcm
x
tioner
−
−
=
(19)
21
12
secint
mm
cc
y
tioner
−
−
=
(20)
If the intersection points coordinates
tioner
x
secint
and
tioner
y
secint
are in the range of the lines beginning
and ending points, it is regarded as critical points.
Otherwise, it is not a critical point.
To make the importance and the necessity of the
critical points more clear, let’s work on an example.
In Figure 3, 2D image of a cube is shown without
visible line detection. Camera view side is also
illustrated in the figure. Critical points are marked as
well. It should be noted that the beginning and the
ending points of the lines are not marked even they
are also intersection points. The lines without any
critical points will be investigated after the
investigation of the critical lines.
There is one more important subject one should
notice that any line of a cube is a member of two
surfaces of the cube. This can be shown in Figure 3
since the line fg is a member of the surface afgk and
fgmh. Thus, if we name the surfaces afgk and fgmh
as native surfaces, visibility of the line fg should be
decided according to its native surfaces visibilities.
As observed in Figure 3, point b and d are the
critical points. They are included in the lines ac, fg,
ce, gh which are also called as critical lines.
Therefore, visibility check should be applied to lines
ab, bc, fb, bg, gd, dh, cd, de. It is achieved by taking
the middle points of these lines for two times since
the lines have two native surfaces. Middle points are
also marked in Figure 3. Let’s call these middle
points as m
i
where i is form 1 to 8 for this case. First
of all, the surfaces which include the point m
i
’s
should be listed. This is simply achieved by
checking the coordinates of the point according to
the surface borders coordinates. Note that the native
surfaces will be included in this surface list as well.
Afterwards, at each m
i
the depths of the all surfaces
in the list are calculated as explained in section 2
and are written in the depth matrix. If the minimum
member of the depth matrix is equal to the depth of
the currently selected native surface, the line is
visible and its state should be set to 1. Otherwise it is
hidden and its state should be set to 0. Thus, the
visibilities of the critical lines are decided. One
should recall that this process is done for two times
since a line has two native surfaces for this example.
Figure 3: Critical points of a cube.
When it comes to the visibilities of the normal
lines which do not have any critical points on it, it is
decided in a similar way of the critical lines. In this
case the middle points of the normal lines are taken
and the visibility of that point is investigated just
like critical lines.
To sum up, algorithms steps are presented as
following:
Step 1 Convert the 3D wire-frame from World to
3D camera frame
Step2 Calculate the coefficients (A, B, C and D) of
all the surfaces on the object
Step3 Convert the coordinates from camera to
image frame.
Step4 Calculate the parameters (m and c) of all
lines.
Step5 Calculate the critical points in the image
Step6 Investigate the visibility of the critical lines
one by one by separating the line according to
its critical points.
Step7 Investigate the visibility of the normal lines.
Step8 Plot the visible lines
4 SIMULATION RESULTS
The algorithm is implemented in Matlab. The results
are presented in this section for two experiments.
First, two surfaces with different depths is presented.
In the second experiment, 3D wireframe model is
defined for five prisms. Camera parameters,
rotations and translations are kept same for both of
the experiments.
Figure 4, 5 and 6 are the simulation results for
the first experiment. One triangle and one
parallelogram are defined in 3D wireframe model.
Thus, corner point’s coordinates and the points that
construct the lines and the surfaces are defined. In
a
c
d
e
f
h
Middle points
Critical points
Camera
view
FAST WIREFRAME-VISIBILITY ALGORITHM
273