Abstract
Present research of visible query focuses on points and segments in twodimensional space, while disfigurements occur during processing of visible query in threedimensional space. In this paper, Continuous Visible Range Query Based on Control Point (CVRQCP) is proposed to solve the visible query in a 3D spatial database. Firstly, the horizontal angle (HA) and Vertical Projection Angle (VPA) for 3D objects in a spatial database were used in the visibility testing method. The HA and VPA in the processing of the continuous visible query created visibility changes, defining and confirming the control point. Finally, the algorithm of Continuous Visible Range Query Based on Control Point (CVRQCP) was proposed. Verified by experiments, the CVRQCP algorithm correctly deals with the visible query of 3D spatial objects. The CVRQCP algorithm has better superior accuracy over present visible queries in 3D spatial databases.
1. Introduction
Continuous query is a kind of common spatial query which is widely used in LocationBased Service (LBS). Some researchers study the continuous query in obstacle space which is named as visible query. Visible queries are widely used in the field of assistant decision, navigation, and security monitoring. Although researches into visible query as VkNN [1], CVkNN [2], and VRkNN [3] are numerous, they focus on twodimensional (2D) space as points and segments. In recent years, threedimensional space applications such as online games and virtual reality applications have become increasingly common. Present researches are unable to deal with the visibility of threedimensional (3D) objects correctly because they cannot properly consider altitudinal dimension influence. Meanwhile, methods using doubleproject in horizontal plane and vertical plane to reduce dimensions are extremely inappropriate and the visible query for 3D objects based on hardware is too expensive to use on a large scale. So there is an urgent need for visible query algorithm in 3D space database. To solve this problem, a method of visibility testing for 3D objects based on horizontal angle (HA) and Vertical Projection Angle (VPA) is proposed and the processing of Continuous Visible Range Query based on this visibility testing method is presented.
To solve the visible query with 3D objects, this paper designs 3D objects models and presents the method of visibility testing based on these models. Because of the visibility changes between nonparallel 3D objects for a query interval in the processing of the Continuous Visible Range Query (CVRQ), the important definition control point is used to reduce computational complexity. We propose an algorithm of the CVRQ Based on Control Point, and its accuracy and validity are validated.
The remainder of the paper is organized as follows: Section 2 reviews related works and defines the problem to be solved. Section 3 proposes the method of visibility testing on 3D objects. Section 4 defines the control point in CVRQ and proposes the processing of CVRQ Based on Control Point (CVRQCP). Section 5 provides the accuracy and validity of visibility testing method and performance of CVRQCP algorithm by analyzing the experiment results. Section 6 provides the conclusions and future research plans.
2. Related Work and Definition
2.1. Related Work
Initially, algorithms of visibility testing were applied to the field of virtual simulation. Whether the objects in the same scene are visible to each other is confirmed using grid computing. The main algorithms include JANUS [4], DYNTACS [5], ModSAF [6] and the improved algorithm is Bresenham algorithm [7]. These algorithms test visibility based on grid computing and therefore request the scene as an integrated file. This defines the algorithms as loadbeforecalculate methods. The scale of the scene is greatly limited under this kind of method due to high requirements on the client’s hardware and network. In recent years, the spatial database is widely used for virtual scenes but the grid computing pattern is not applied in this background.
Alipour et al. [8] proposed an algorithm using quadratic preprocessing time and space to solve the visibility testing problem. Chen and Wang [9] researched weak visibility queries of line segments in simple polygons. Hershberger [10] constructed the visibility graph in a simple polygon in time, whereas Ghosh and Mount [11] established its construction in time for a polygon with holes. Here, is the number of edges in the resulting visibility graph. Nouri Baygi and Ghodsi [12] constructed the visibility graph in a polygonal domain in time. However, these studies did not involve the visibility testing of 3D objects. Currently, there is no appropriate visibility testing algorithm for 3D objects in spatial database. Regarding research of visible query in databases, Zhang et al. [13] proposed an integrated framework that efficiently answers most types of spatial queries in obstacles databases. Nutanong et al. [1] defined a Visible k Nearest Neighbor (VkNN) search with minimum visible distance (MinViDist). The VkNN query incrementally computes the visible neighbors as the search space is enlarged. This brings response time of the query processing up to 35%. Gao et al. [3] introduced a Visible Reverse k Nearest Neighbor (VRkNN) search in a spatial database and proposed an efficient algorithm for VRNN query processing, assuming that and are indexed by trees. No preprocessing was required, and halfplane property and visibility checks were utilized to prune the search space. Gao et al. [2] developed an efficient continuous visible nearest neighbor (CVNN) algorithm to tackle the CVNN problem by performing a single query for the entire query line segment. Lu et al. [14] used the Voronoi diagram to store and search potential visible objects, improving query speed while increasing the computational complexity. Gu et al. [15] proposed a Continuous k Nearest Neighbor (CkNN) query based on control point to improve CPU efficiency and I/O. Wang et al. [16] achieved Visible k Nearest Neighbor (VkNN) query on moving objects by using periodic queries and tree indexes.
All the aforementioned research focuses on 2D spatial databases, and existing algorithms cannot properly deal with the visible query of 3D objects. If we test the visibility of 3D objects by dimensionreduction with doubleprojection as the present visibility testing method, results will be incorrect due to lack of a proper projection plane for 3D objects with different rotation angles. Thus, this paper addresses the problems of 3D objects visibility testing and query algorithms.
2.2. Definition
Definition 1 (threedimensional spatial object). A threedimensional spatial object is a cube with as the center of the cube, and , where , , and are the coordinates of . , where is the range of the cube. , , and are the ranges in each dimension. is the cube’s rotation angle in horizontal plane (Figure 1).
(a) 3D object
(b) Projection and rotation angle in horizontal plane
In this model, the rotation angle in the vertical plane is zero by default, making the horizontal plane the unified projection plane. With different rotation angles in the horizontal plane, the projections of 3D objects do not have a unified vertical projection plane to reduce dimension through doubleprojection. Therefore, a new method for visibility testing of 3D objects is needed.
Definition 2 (minimum euclidean distance (MinDist)). If is the projection of the 3D object in the horizontal plane of query point , then MinDist is the minimum Euclidean distance between and (Figure 2(a)). MinDist between and a query interval is the minimum Euclidean distance between and any point in (Figure 2(b)).
(a) MinDist for query point
(b) MinDist for query interval
Definition 3 (projection angle, PA). The 3D object is and the query point is . Rectangle is used to replace during the visibility testing to simplify calculation. At any point in the segment , the highest corresponding point is (Figure 3(a)). The rectangle is the projection of in the horizontal plane (Figure 3(b)). Then, of is the projection angle (Figure 3(c)).
(a) 3D object
(b) Projection of 3D object in horizontal plane
(c) Projection angle as
The projection angle in the vertical plane is used to describe the influences of height dimension on visibility of 3D objects.
Definition 4 (Visible). The 3D objects are , an obstacle , and a query point . The point connects and and does not intersect with . Then, is visible to .
Definition 5 (Continuous Visible Range Query on Threedimensional Objects). The 3D objects are set as , an obstacle , and a query interval . CVRQ as is a visibility search with results of this search visible to a subinterval of and the MinDist between the result and is less than the radius , and .
By defining these data models, why visible query in 2D could not be directly used in 3D through doubleprojection is explained.
3. Visible Range Query on ThreeDimensional Objects
3.1. Visibility Testing on 3D Objects
The visibility testing on 3D objects is divided into two parts. First, preliminary filter for projection is created in the horizontal plane. Second, visibility testing for the objects, which are completely obscured in the horizontal plane, is conducted.
During the visibility testing in the horizontal projection plane, all 3D objects are projected to the horizontal plane of the query point. The projection of 3D object is described as a segment to simplify calculations (Figure 4(a)). In the first step for visibility testing, 3D objects , , and are projected to the horizontal plane of query point . 2D visibility testing of the projections filtered out visible objects. As shown in Figure 4(a), the projections of and are visible to , and therefore, the 3D objects and are naturally visible to . The projection of is invisible to in the horizontal plane because it is covered by the projection of , resulting in 3D object requiring further visibility testing in the vertical plane (the second step for testing). As illustrated in Figure 4(b), if the projection angle of is larger than , is visible to even if its projection is completely obscured in the horizontal plane. This reflects the principle that a farther object could not affect the visibility of a closer object. Therefore, to avoid the impact of inserted objects, visibility testing of 3D objects is done in order by MinDist.
(a) Visibility testing for projections in horizontal plane
(b) Influence of projection angle for visibility
The projection angle of 3D objects acts as a variable in this second step of visibility testing. The projection angle is related to the distance between the query point and the projection of the 3D object in the level plane of query point (Figure 5(a)). The projection angle is calculated as Formula (1), where is the height of the 3D object and is the distance between the query point and the corresponding point . is calculated as Formula (2), where is the coordinates of point . The horizontal angle between and is calculated as Formula (3). As shown in Figure 5(b), point has the minimum distance between object and query point . Therefore, is the maximum projection angle between and . Then, the coordinate system based on and is built to describe the visibility of the 3D object using these three formulas. If the projection angle of is bigger than in the same horizontal angle, then is not obscured by . Otherwise, is invisible:
(a) Calculation of the projection angle
(b) Distance between query point and different points in projection of object
The function curve of the projection angle as calculated using Formulas (1) and (2) is shown in Figure 6(a). The axis is and the axis is , and the curve is of object . In the same way, the curves of and are illustrated in Figure 6(b). The visibility of 3D objects is calculated by comparing the projection angle in the same horizontal angle. The curves for objects and in Figure 4(a) are shown in Figure 6(b) and . Therefore, is obstructed by all the time, and is invisible to query point .
(a) Projection angle curve of object
(b) Projection angle curves of objects and
3.2. Visible Range Query in 3D Objects
According to the visibility testing method based on the horizontal and projection angles, the algorithm of Visible Range Query (VRQ) in 3D object is proposed. In VRQ, the first step is to use a range query to determine involved objects. Then, the primary object set is sorted using MinDist. Finally, the visibility of the primary objects is calculated one by one. If an object is visible, its added to the result set, and the obstacle set is updated. Otherwise, it must be covered by other objects in the obstacle set. This process is looped until the entire primary set is completely processed.
The obstacle set creates an obstacle curve in the system (Figure 7(a)). The point in the curve is the maximum projection angle in the corresponding horizontal angle. For example, is inserted into the obstacle set, and the obstacle curve is updated (Figure 7(b)).
(a) Projection angle curves of objects and
(b) Projection angle curve of obstacle set
According to these steps, the VCR algorithm is proposed as shown in Algorithm 1.

In line , the range query obtains the primary set of objects. Then, the set is sorted by MinDist. In line , the visibility testing of the objects is processed through the loop. In line , the primary filter is done in horizontal plane. If the projection of the object is not covered then the object is visible. Otherwise, further filtering based on the projection angle is conducted for more accurate visibility testing. Next, the projection angle curve in the system is calculated, the resulting curve is compared to the obstacle curve, and the visibility of the object is calculated. After processing all objects, the result set is returned in line .
4. Continuous Visible Range Query
4.1. Continuous Visible Range Query
Continuous Visible Range Query (CVRQ) is a range query and a visible query. The primary set of 3D objects is obtained by the range query, and the resulting set is calculated from the primary set through visibility testing.
Let us take a CVRQ with radius as an example. In step one, the entire query interval is divided into a group of segments, and the range query for each segment determines the primary set of 3D objects. Then, the primary set is sorted and visible objects are obtained by visibility testing.
In the CVRQ, the visibility testing is a segment between the objects and query interval (Figure 8(a)). The visibility testing of segments is divided into two parts: one in a horizontal plane, and the other in a vertical plane. Only the projection angle of objects completely covered in the horizontal plane needs to be calculated in visibility testing.
(a) Visibility testing of segment
(b) Visible area
As an example to introduce the visibility testing of segments, segment is the query interval (Figure 8(a)). The visible areas results are shown in Table 1. and are the projections of 3D objects in the horizontal plane. Since , is in the obstacle set when is inserted. Based on the terminals of and , is divided into three subintervals: , , and . is the Visible Area (VA) and is described as , and is the Invisible Area (IA) and is described as . The VA of object is the complement set of the IA as shown in Formula (4). and are in the obstacle set before inserting (Figure 8(b)). The IA of object to the query interval is the union set of all IAs between object and obstacle objects as shown in Formula (5). and , so . Then, as shown in Formula (6):
4.2. Point Change and Control Point
There is a distinctive visibility change during continuous visible query on 3D objects. The distances between the query point and 3D objects constantly change, along with the projection angles. This may cause the obstacle relationships between objects to also change. For example, when we walk along the street, a building may disappear behind another building. In this paper, the and are defined as follows.
Definition 6 (Point Change (PC)). Point Change is an end point of the projection of 3D object . If the visibility of projection as changes in the obstacle area , then when the query point moves from Point to point in the query interval, PC is the earliest, or latest, visible point in projection of .
Definition 7 (control point (CP)). Control point is a point in obstacle area that divides the into two different parts. In one part, is visible, and in the other part it is invisible because of .
When is just visible to the query point in the query interval, , where is the height dimension of the 3D object (Figure 9(a)). Since is parallel to , . Therefore, due to . The other points in are invisible, so point is the Point Change. Similarly, point is PC in Figure 9(b).
(a)
(b)
Conclusively, the PC is related to the relationship between objects’ rotation angles in horizontal plane. When , the PC is the point which is the closest point in the projection of 3D object in the horizontal plane. Otherwise, the PC is the farthest point.
The trace of query is a query interval during Continuous Visible Range Query (CVRQ) on 3D objects. The projection angle between the object and the query interval is a continuous variable, and the visibility of object may change. For example, is invisible to query point due to , but with travel from point to point , the distance between and the query interval is shortened while the distance between and the query interval is lengthened. Therefore, the projection angle between and the query interval decreases while the projection angle between and the query interval increases. However, the visible relationship between and the query interval may change if is larger than at a certain point in the query interval. That point is a control point (CP) to . Since it divided the query interval into two subintervals for by , it is described as :
Query interval and projections of objects and are shown in Figure 10. Since , point is the Point Change in to . For any point in the query interval, will be invisible because of at some point. If a straight line which goes through point crosses at and crosses at so that , then the relationship between and is the same as shown in Figure 11 and Formula (7). Ultimately, the control point depends on the Point Change.
As shown in Figure 12, point is the Point Change (PC) of object , represents object , and is the query interval. is vertical to . The coordinate of is calculated using Formula (7). is vertical to and crosses at point . which is the line through points and crosses at point . Point is the control point as . The CP is unique as in Theorem 8 proof.
Theorem 8 (unique control point). According to the PC, the control point could be calculated and there is only one CP.
Proof. A vertical line crosses point and meets at point (Figure 12). The resulting line is . According to , to get the only point to satisfy the formula , the vertical line crosses point and meets line at point . Point is unique because is not parallel to . Then, line crosses the points and and meets at point , and . If there are two CPs in the query interval, meets at two points. This is impossible, and therefore, point is the only control point.
If is parallel to , the objects have the same rotation angle in the horizontal plane, and the visible relationship between and will not change in the obstacle area. As shown in Figure 13, is the OA of object by . At any point in the OA, a straight line crosses at and crosses at . The rate of projection angles of these two points is invariable (Formula (8)), and the visible relationship will not change in the OA. In these calculations, is the height dimension of the object:
(a) Horizontal plane
(b) Projection angle
The obstacle area is divided into two subintervals with different visibility by the control point in the CVRQ.
4.3. Continuous Visible Range Query Based on Control Point (CVRQCP)
In Figure 14, the projections of 3D objects , , , and are sorted by MinDist. The height dimensions of the objects are 4, 5, 3, and 7, respectively. is point . The results of visibility testing are shown in Table 2.
When is inserted, the obstacle set is empty, so is visible to the entire query interval, and is put in both the result and the obstacle sets. Next, is inserted by order. The VA and IA are obtained through visibility testing, and is calculated. The VA and IA of object are updated. Then, all objects are inserted one by one in order, and visibility testing is conducted. Finally, the result set is reconstructed and summarized.
The algorithm of Continuous Visible Range Query Based on Control Point is proposed as shown in Algorithm 2.

The range query based on the query interval in object is done in line , and results are sorted by MinDist in line to avoid the influence of inserted objects. In line , the visibility testing of obstacle objects is calculated in order. During testing, the control point is calculated if the insert object is not parallel to the obstacle object. If the CP is in the IA, then it needs to be recorded in the result set. In line , the result set is reconfigured to summarize the visible objects for each subinterval of the query interval.
5. Experimental Evaluations
This section compares performance of three algorithms of visible query: BasicAlgorithmone (Basic I); BasicAlgorithmtwo (Basic II), a doubleprojection algorithm that separately processes the projections of 3D objects in the horizontal and vertical planes and describes visibility by their intersection; the CVRQ Based on Control Point algorithm, proposed in this paper as CVRQCP. Performance evaluation was conducted on an Intel(R) Core(TM) i5 machine with 4 GB memory, running Microsoft Windows XP Professional Edition. The program was written in C++ in Visual Studio.net 2010 development environment, called algorithm subroutine written in MATLAB R2012b.
Four datasets were created using the Spatial Object Data Generator and normally distributed in threedimensional spaces. Table 3 lists all the parameters of datasets in the experiments. Dataset III contains 500 objects, as shown in Figure 15. The entire experiment is divided into two parts. The first part of the experiment is carried out in Datasets I, II, and III. The purpose of this part is to verify the correctness and performance of the 3D visibility testing method which is proposed in this paper. The second part of the experiment is carried out in Dataset IV to verify the influence of the query radius and the query interval length on the performance of CVRQCP.
In the first part of the experiment, in order to prove the influence of the quantity and density of object on the accuracy and response time of the query, 500 queries were done for each of the three algorithms in Datasets I, II, and III. To verify the accuracy of the three algorithms, we upload the objects in result list of the visible query in 3DMax and verify the correctness by manual inspection. The radius of range query is 250 and the query length is 0 in these experiments.
Accuracy results are shown in Figure 16. Obviously, the CVRQCP algorithm is more accurate than the other two algorithms. In Basic I, the height dimension of the objects is not considered, and the result set of visible query underwent little change across the three different scales. Therefore, the average accuracy rate decreased as the number of 3D objects increased. In Basic II, projections in the vertical plane were unable to describe the relationship between two objects due to rotation in the horizontal plane, and therefore, the average accuracy rate decreased as the number of 3D objects increased. However, since Basic II considers the influence of height, it is more accurate than Basic I. Conversely, for the CVRQCP algorithm, the projection of a 3D object is considered a segment. Although the accuracy is not 100%, the rate of accuracy is much higher than in Basic I and Basic II.
Response time results are shown in Figure 17. Each object in query range must be read and calculated in all three algorithms. This results in reduced query speed. The number of objects in query range has obvious influence on the response time. The same algorithm with same parameters has distinctly different response time in three different datasets. The only reason is that the number of objects in query range is different. The response time of the visible query increases as the number of obstacle objects increases. Meanwhile, compared in the same dataset, Basic I is fastest while the CVRQCP algorithm is slowest. In Basic I, visibility testing is only required once, in a horizontal plane. Meanwhile, the same calculation must be executed twice in Basic II, in both the horizontal and the vertical planes. On the other hand, CVRQCP algorithm includes projection angle calculation. Each visible object added to the obstacle set participates in the visibility testing of the subsequent object.
Since the Continuous Visible Range Query is regarded as a range query for a segment, the radius and query length greatly influence the visible query. The number of relevant objects increases with increasing radius under the same query length. Furthermore, response time dramatically increases with an increasing number of relevant objects due to the iteration in visibility testing. Each object in obstacle set may create a subinterval needing calculation.
The second part of experiment is to prove the influence of the query length and radius on the response time and I/O performance. This part of the experiment is done in Dataset IV. Dataset IV contains 5000 objects, as shown in Figure 18. Table 4 lists all the parameters that are considered in the experiments, with numbers in bold representing default settings. In each experiment, only one parameter is changed in order to evaluate its impact on the performance, while all the other parameters are fixed at their defaults. We run 200 queries for each experiment, and the average performance is reported.
Response time results under different radius are shown in Figure 19. The number of relevant objects increases with increasing radius under the same query length. Furthermore, response time dramatically increases with an increasing number of relevant objects due to the iteration in visibility testing. Each object in obstacle set may create a subinterval needing calculation.
Response time results under different query length are shown in Figure 20. The number of relevant objects increases with increasing query length under the same radius. Furthermore, response time dramatically increases with an increasing number of relevant objects due to the iteration in visibility testing. Each object in obstacle set may create a subinterval needing calculation.
The average access number of node increased with the visible query radius and the radius of range. The result of I/O is shown in Figure 21. Conclusively, the visible query radius has more significant impact than the query interval length. As a result, the radius is very important in the visible query application. If the radius is too small, the VR scene will be too small to simulate a realistic view of the human to reduce the reality. On the other hand, a large radius may render response time too long to effect the application of visible query.
6. Conclusions
The visible query for threedimensional objects plays an important role in largescale virtual reality scenes, such as in online games and virtual cities. The algorithm Continuous Visible Range Query Based on Control Point (CVRQCP) proposed in this paper addresses the lack of a specific algorithm for visible query for threedimensional objects. The visibility testing based on projection angles in the vertical plane describes the visibility of 3D objects, while the control point describes the distinctive visibility change caused by changing distances during continuous visible query for 3D objects. Experimentation showed CVRQCP accuracy as superior to present algorithms.
However, some deficiencies require further research. For example, we kept the query interval in a horizontal plane, preventing the CVRQCP algorithm from dealing with some situations. We recommend further study of CVRQCP processing to solve these problems and optimize I/O operation in 3D spatial databases.
Competing Interests
The authors declare that they have no competing interests.
Acknowledgments
This work is supported by the National Natural Science Foundation of China under Grant no. 61572422 and the Natural Science Foundation of Hebei Province, China, under Grant no. F2013203187.