CN102117501A - Method and device for rendering three-dimensional lines - Google Patents

Method and device for rendering three-dimensional lines Download PDF

Info

Publication number
CN102117501A
CN102117501A CN2009102589522A CN200910258952A CN102117501A CN 102117501 A CN102117501 A CN 102117501A CN 2009102589522 A CN2009102589522 A CN 2009102589522A CN 200910258952 A CN200910258952 A CN 200910258952A CN 102117501 A CN102117501 A CN 102117501A
Authority
CN
China
Prior art keywords
dimentional
apex coordinate
value
polygonal
apex
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2009102589522A
Other languages
Chinese (zh)
Other versions
CN102117501B (en
Inventor
叶伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Xiamen Autonavi Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Autonavi Software Co Ltd filed Critical Xiamen Autonavi Software Co Ltd
Priority to CN200910258952.2A priority Critical patent/CN102117501B/en
Publication of CN102117501A publication Critical patent/CN102117501A/en
Application granted granted Critical
Publication of CN102117501B publication Critical patent/CN102117501B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention provides a method and device for rendering three-dimensional lines. The method comprises the following steps of: projecting an (n-1)th three-dimensional vertex coordinate and an nth three-dimensional vertex coordinate in a preset three-dimensional vertex coordinate set to an XZ plane to obtain the (n-1)th two-dimensional vertex coordinate and the nth two-dimensional vertex coordinate; calculating four two-dimensional vertex coordinates of a polygon according to a given line width and an included angle between X-axis and a straight line formed between the (n-1)th two-dimensional vertex coordinate and the nth two-dimensional vertex coordinate; and reducing the four two-dimensional vertex coordinates of the polygon into four three-dimensional vertex coordinates, and filling the polygon formed by the four three-dimensional vertex coordinates to obtain an (n-1)th line segment, wherein n is a natural number larger than or equal to 2. The invention further provides a device for rendering the three-dimensional lines to realize the method. The three-dimensional line rendering technical scheme provided by the invention does not render lines in a screen two-dimensional space (an XY plane), but renders the lines based on real three-dimensional space coordinates, thereby finally making the rendered lines have a three-dimensional space perspective effect.

Description

A kind of 3D lines method for drafting and device
Technical field
The present invention relates to the computer graphics disposal technology field, relate in particular to a kind of 3D lines method for drafting and device.
Background technology
(Computer Graphics is to develop rapid, widely used new branch of science in recent decades CG) to computer graphics, and research to the effect that is presentation graphic in computing machine how, and utilizes computing machine to carry out calculating, processing and the demonstration of figure.
The development of computer graphics mainly is divided into two stages, and in a 2D (2-Dimensinal) the figure stage, another is 3D (3-Dimensinal) the figure stage.At present, DirectX and OpenGL are two 3D graphical development platforms of main flow, these two platforms realize virtual reality play up aspect performance all very outstanding, but but be not very desirable in effect aspect the drafting of 3D lines.
Existing 3D lines method for drafting based on DirectX mainly comprises the steps: given line width and one group of 3D coordinate, at first calculate four apex coordinates of corresponding polygon (rectangle) according to first and second 3D coordinate and live width, fill the polygon that constitutes by these four apex coordinates then and form one section line segment, then to second and the 3rd 3D coordinate, the 3rd and the 4th 3D coordinate, ..., n-1 is individual to carry out same processing with n 3D coordinate, last 3D coordinate in handling above-mentioned 3D set of coordinates obtains 3D lines.
Existing 3D lines method for drafting based on OpenGL is identical substantially with the scheme based on DirectX, not filled polygon when draw line segments just, but be that " brush " of live width drawn lines with a width, when the line segment slope [1,1] time, the brush direction is vertical, and the line segment slope is not [1,1] time, the brush direction is a level.
In research and practice process to prior art, the inventor finds the coordinate that existing polygonal four apex coordinates that go out according to given 3D coordinate Calculation based on the 3D lines method for drafting of DirectX are 2D space (XY spaces), and be planar graph by the polygon that the apex coordinate in 2D space constitutes, therefore, the lines that prior art is finally drawn out have only the plane effect in 2D space, and do not have the transparent effect of 3d space.And not only do not have the transparent effect of 3d space based on the lines that the 3D lines method for drafting of OpenGL is drawn out, and lines have the inconsistent phenomenon of thickness.
Summary of the invention
The technical matters that the embodiment of the invention will solve provides a kind of 3D lines method for drafting and device, can draw out the lines with 3d space transparent effect.
For solving the problems of the technologies described above, the objective of the invention is to be achieved through the following technical solutions:
The embodiment of the invention provides a kind of 3D lines method for drafting, and described method comprises:
With a n-1 in the three-dimensional vertices set of coordinates that presets and n three-dimensional vertices coordinate projection to the XZ plane, obtain n-1 with the individual two-dimentional apex coordinate of n;
According to the straight line of n-1 and n two-dimentional apex coordinate formation and the angle of X-axis, and given live width, polygonal four two-dimentional apex coordinates calculated;
Described polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates, fill the polygon that constitutes by four three-dimensional vertices coordinates, obtain n-1 bar line segment; Wherein, n is the natural number more than or equal to 2.
The embodiment of the invention also provides a kind of 3D lines drawing apparatus, and described device comprises:
The two-dimensional coordinate projecting cell is used for n-1 of the three-dimensional vertices set of coordinates that will preset and n three-dimensional vertices coordinate projection to the XZ plane, obtain n-1 with the individual two-dimentional apex coordinate of n;
The apex coordinate computing unit is used for according to the straight line of n-1 and n two-dimentional apex coordinate formation and the angle of X-axis, and given live width, calculates polygonal four two-dimentional apex coordinates;
The three-dimensional coordinate reduction unit is used for described polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates;
The lines drawing unit is used to fill the polygon that is made of four three-dimensional vertices coordinates, obtains n-1 bar line segment; Wherein, n is the natural number more than or equal to 2.
Technique scheme has following beneficial effect:
The 3D lines rendering technique that the embodiment of the invention provides, before filled polygon, polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates, because the polygon that four three-dimensional vertices coordinates constitute no longer is two-dimensional space figure but three dimensions figure, therefore, the technical scheme that the embodiment of the invention provides is not to draw lines at screen two-dimensional space (XY plane), draw lines and be based on the true three-dimension volume coordinate, finally make the lines of drafting have the 3d space transparent effect.
Description of drawings
The 3D lines method for drafting process flow diagram that Fig. 1 provides for the embodiment of the invention;
Fig. 2 forms synoptic diagram for the 3D lines drawing apparatus that the embodiment of the invention provides;
The 3D lines design sketch that Fig. 3 draws for the 3D lines method for drafting that the employing embodiment of the invention provides.
Embodiment
For the purpose that makes the embodiment of the invention, technical scheme, and advantage clearer, below the technical scheme that the embodiment of the invention provides is elaborated with reference to accompanying drawing.
See also Fig. 1, be a kind of 3D lines method for drafting that the embodiment of the invention provides, this method comprises the steps:
Step 101: with n-1 three-dimensional vertices coordinate (x in the three-dimensional vertices set of coordinates that presets N-1, y N-1, z N-1) and n three-dimensional vertices coordinate (x n, y n, z n) project to the XZ plane, obtain n-1 two-dimentional apex coordinate (x N-1, z N-1) and n two-dimentional apex coordinate (x n, z n), n is the natural number more than or equal to 2;
Wherein, the three-dimensional vertices coordinate projection is meant to the XZ plane y value of three-dimensional vertices coordinate ignored or is made as zero.
Step 102: according to the straight line of n-1 and n two-dimentional apex coordinate formation and the angle of X-axis, and given live width, calculate polygonal four two-dimentional apex coordinates;
Step 103: described polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates;
Wherein, described polygonal four two-dimentional apex coordinates being reduced to four three-dimensional vertices coordinates is specially: with the z of n-1 three-dimensional vertices coordinate N-1As Z, with the z of n three-dimensional vertices coordinate according to polygonal two summits of its calculating nAs Z according to polygonal two summits of its calculating.
Such as, according to n-1 three-dimensional vertices coordinate Calculation polygonal first and second two-dimentional apex coordinate, according to n three-dimensional vertices coordinate Calculation polygonal the 3rd and the 4th two-dimentional apex coordinate, then when reducing, with z N-1As the Z of first and second apex coordinate, with z nZ as the 3rd and the 4th apex coordinate.
Step 104: fill the polygon that constitutes by four three-dimensional vertices coordinates, obtain n-1 bar line segment.
In actual applications, the stuffing function that can call among the DirectX/OpenGL is filled the polygon of four three-dimensional vertices coordinates formations and is carried out anti-aliasing processing.
More than the 3D lines method for drafting that provides for the embodiment of the invention, this method is reduced to four three-dimensional vertices coordinates with polygonal four two-dimentional apex coordinates before filled polygon, because the polygon that four three-dimensional vertices coordinates constitute no longer is two-dimensional space figure but three dimensions figure, therefore, the technical scheme that the embodiment of the invention provides is not to draw lines at screen two-dimensional space (XY plane), draw lines and be based on the true three-dimension volume coordinate, finally make the lines of drafting have the 3d space transparent effect.
Below in conjunction with instantiation the method that the embodiment of the invention provides is described in detail.Suppose, m three-dimensional vertices coordinate arranged in the three-dimensional vertices set of coordinates that presets, at first first and second three-dimensional vertices coordinate in the three-dimensional vertices set of coordinates are handled according to method shown in Figure 1, obtain article one line segment, if also have coordinate in the described set of coordinates, then second and the 3rd three-dimensional vertices coordinate are handled according to method shown in Figure 1 again, obtain the second line segment, if also have coordinate in the described set of coordinates, then repeat method shown in Figure 1, all coordinate in handling set of coordinates finally obtains a 3D line segment.
It should be noted that when m more than or equal to 3 the time, can obtain at least two line segments, in order to make smooth connection between every line segment, in said method, may further include:
The polygon that four three-dimensional vertices coordinates that the n-2 line segment that filling has obtained is adjacent with n-1 bar line segment constitute makes n-2 line segment and the smooth connection of n-1 bar line segment.
Such as, after obtaining the second line segment, the polygon that four three-dimensional vertices that article one line segment that filling has obtained is adjacent with the second line segment constitute, after obtaining the 3rd line segment, fill second line segment and the 3rd polygon that four adjacent three-dimensional vertices coordinates of line segment constitute, ..., by that analogy.
Following situation according to n-1 and n two-dimentional apex coordinate and X-axis angle describes in detail to the process of polygonal four the two-dimentional apex coordinates of the described calculating of preamble.
Suppose that polygonal four two-dimentional summits are respectively (X 1, Z 1), (X 2, Z 2), (X 3, Z 3) and (X 4, Z 4), given live width is LineWidth, then
The 1st kind, n-1 two-dimentional apex coordinate (x N-1, z N-1) and n two-dimentional apex coordinate (x n, z n) straight line parallel that constitutes is in X-axis, i.e. z N-1=z n, then calculate polygonal four two-dimentional apex coordinates and be specially:
X 1=x n-1,Z 1=z n-1+LineWidth/2;X 2=x n-1;,Z 2=z n-1-LineWidth/2;
X 3=x n,Z 3=z n-LineWidth/2;X 4=x n,Z 4=z n+LineWidth/2;
The 2nd kind, n-1 and n the straight line that two-dimentional apex coordinate constitutes be perpendicular to X-axis, i.e. x N-1=x n, then calculate polygonal four two-dimentional apex coordinates and be specially:
X 1=x n-1-LineWidth/2,Z 1=z n-1;X 2=x n-1+LineWidth/2,Z 2=z n-1
X 3=x n+LineWidth/2,Z 3=z n;X 4=x n-LineWidth/2,Z 4=z n
The 3rd kind, the straight line of n-1 and n two-dimentional apex coordinate formation both had been not orthogonal to X-axis, also was not parallel to X-axis, then calculated polygonal four two-dimentional apex coordinates and was specially:
Calculate the straight line of n-1 and n two-dimentional apex coordinate formation and the angle theta of X-axis;
In actual applications, angle theta can adopt following formula to calculate:
θ=atan[(z n-z N-1)/(x n-x N-1)], the built-in function of atan for can directly calling.
Absolute value with sin θ multiply by LineWidth/2, obtains X-axis side-play amount OffsetX;
Absolute value with cos θ multiply by LineWidth/2, obtains Z axle offset amount OffsetZ;
Judge the quadrant at angle theta place, according to the quadrant at angle theta place, n-1 and the individual two-dimentional apex coordinate of n and OffsetX and OffsetZ calculate polygonal four two-dimentional apex coordinates.
If angle theta is first or third quadrant, i.e. 0 °<angle theta<90 ° or 180 °<angle theta<270 °, then calculate polygonal four two-dimentional apex coordinates and be specially:
X 1=x n-1-OffsetX,Z 1=z n-1+OffsetZ;X 2=x n-1+OffsetX,Z 2=z n-1-OffsetZ;
X 3=x n-OffsetX,Z 3=z n+OffsetZ;X 4=x n+OffsetX;,Z 4=z n-OffsetZ;
If angle is second or four-quadrant, i.e. 90 °<angle theta<180 ° or 270 °<angle theta<360 °, then calculate polygonal four two-dimentional apex coordinates and be specially:
Whether judge n-1 and n the slope that two-dimentional apex coordinate constitutes straight line smaller or equal to 1, more than or equal to negative 1, if, then
X 1=x n-1+OffsetX,Z 1=z n-1+OffsetZ;X 2=x n-1-OffsetX,Z 2=z n-1-OffsetZ;
X 3=x n+OffsetX,Z 3=z n+OffsetZ;X 4=x n-OffsetX;,Z 4=z n-OffsetZ;
If not, then
X 1=x n-1-OffsetX,Z 1=z n-1-OffsetZ;X 2=x n-1+OffsetX,Z 2=z n-1+OffsetZ;
X 3=x n-OffsetX,Z 3=z n-OffsetZ;X 4=x n+OffsetX;,Z 4=z n+OffsetZ。
More than 3D lines method for drafting that the embodiment of the invention is provided be described in detail, the 3D lines drawing apparatus of the realization said method that the embodiment of the invention is provided below in conjunction with accompanying drawing describes in detail
See also Fig. 2, form synoptic diagram for the 3D lines drawing apparatus that the embodiment of the invention provides, this device comprises:
Two-dimensional coordinate projecting cell 201 is used for n-1 of the three-dimensional vertices set of coordinates that will preset and n three-dimensional vertices coordinate projection to the XZ plane, obtain n-1 with the individual two-dimentional apex coordinate of n;
Apex coordinate computing unit 202 is used for according to the straight line of n-1 and n two-dimentional apex coordinate formation and the angle of X-axis, and given live width, calculates polygonal four two-dimentional apex coordinates;
Three-dimensional coordinate reduction unit 203 is used for described polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates;
Lines drawing unit 204 is used to fill the polygon that is made of four three-dimensional vertices coordinates, obtains n-1 bar line segment; Wherein, n is the natural number more than or equal to 2.
It should be noted that when m more than or equal to 3 the time, can obtain at least two line segments, in order to make smooth connection between every line segment, in said apparatus, may further include:
Connect the line segment drawing unit, be used to fill the polygon that n-2 line segment four the three-dimensional vertices coordinates adjacent with n-1 bar line segment that obtained constitute, make n-2 line segment and the smooth connection of n-1 bar line segment.
More than the 3D lines drawing apparatus that provides for the embodiment of the invention, below according to the situation of n-1 and n two-dimentional apex coordinate and X-axis angle, the specific implementation of the described apex coordinate computing unit 202 of preamble is described in detail.
First kind, the straight line parallel of n-1 and n two-dimentional apex coordinate formation is in X-axis, and then described apex coordinate computing unit 202 specifically comprises:
First and second summit computing unit is used for xn-1 is composed to polygonal first and second two-dimentional apex coordinate X 1And X 2Use z N-1Add LineWidth/2, obtain the Z of polygonal first two-dimentional apex coordinate 1Use z N-1Deduct LineWidth/2, obtain the Z of polygonal second two-dimentional apex coordinate 2
Second and third summit computing unit is used for x nCompose the X that gives polygonal the 3rd and the 4th two-dimentional apex coordinate 3And X 4Use z nAdd LineWidth/2, obtain the Z of polygonal the 3rd two-dimentional apex coordinate 3Use z nDeduct LineWidth/2, obtain the Z of polygonal the 4th two-dimentional apex coordinate 4
Second kind, the straight line of n-1 and n two-dimentional apex coordinate formation is perpendicular to X-axis, and then described apex coordinate computing unit 202 specifically comprises:
First and second apex coordinate computing unit is used for z N-1Value compose to be given the Z of polygonal first and second two-dimentional apex coordinate 1And Z 2, use x N-1Add LineWidth/2, obtain the X of polygonal first two-dimentional apex coordinate 1, use x N-1Deduct LineWidth/2, obtain the X of polygonal second two-dimentional apex coordinate 2
Second and third apex coordinate computing unit is used for z nCompose the Z that gives polygonal the 3rd and the 4th two-dimentional apex coordinate 3And Z 4, use x nAdd LineWidth/2, obtain the X of polygonal the 3rd two-dimentional apex coordinate 3, use x nDeduct LineWidth/2, obtain the X of polygonal the 4th two-dimentional apex coordinate 4
The third, the straight line of n-1 and n two-dimentional apex coordinate formation both had been not orthogonal to X-axis, also was not parallel to X-axis, and then apex coordinate computing unit 202 specifically comprises:
The included angle of straight line computing unit is used to calculate the straight line of n-1 and n two-dimentional apex coordinate formation and the angle theta of X-axis;
X-axis side-play amount computing unit is used for multiply by with the absolute value of sin θ half of given live width, obtains X-axis side-play amount OffsetX;
Z axle offset amount computing unit is used for multiply by with the absolute value of cos θ half of given live width, obtains Z axle offset amount OffsetZ;
Included angle of straight line quadrant judging unit is used to judge the quadrant at angle theta place;
The apex coordinate computation subunit is used for the quadrant according to the angle theta place, and n-1 and the individual two-dimentional apex coordinate of n and X-axis side-play amount and Z axle offset amount are calculated polygonal four two-dimentional apex coordinates.
Wherein, if included angle of straight line quadrant judgment unit judges obtains described 0 °<angle theta<90 ° or 180 °<angle theta<270 °, then described apex coordinate computation subunit specifically comprises:
The first apex coordinate computing unit is used to x N-1Deduct OffsetX, obtain the X of polygonal first two-dimentional apex coordinate 1, use z N-1Add OffsetZ, obtain the Z of polygonal first two-dimentional apex coordinate 1
The second apex coordinate computing unit is used x N-1Add OffsetX, obtain the X of polygonal second two-dimentional apex coordinate 2, use z N-1Deduct OffsetZ, obtain the Z of polygonal first two-dimentional apex coordinate 2
The 3rd apex coordinate computing unit is used to x nDeduct OffsetX, obtain the X of polygonal the 3rd two-dimentional apex coordinate 3, use z nAdd OffsetZ, obtain the Z of polygonal the 3rd two-dimentional apex coordinate 3
The 4th apex coordinate computing unit is used to x nAdd OffsetX, obtain the X of polygonal the 4th two-dimentional apex coordinate 4Use z nDeduct OffsetZ, obtain the Z of polygonal the 4th two-dimentional apex coordinate 4
If included angle of straight line quadrant judgment unit judges obtains described 90 °<angle theta<180 ° or 270 °<angle theta<360 °, then described apex coordinate computation subunit specifically comprises:
The straight slope judging unit.Be used to judge described if the slope that n-1 and n two-dimentional apex coordinate constitute straight line whether smaller or equal to 1, more than or equal to negative 1;
The first apex coordinate computing unit 1 is used at slope smaller or equal to 1, more than or equal to negative 1 o'clock, uses x N-1Add OffsetX, obtain the X of polygonal first two-dimentional apex coordinate 1Use z N-1Add OffsetZ, obtain the Z of polygonal first two-dimentional apex coordinate 1
The second apex coordinate computing unit 1 is used at slope smaller or equal to 1, more than or equal to negative 1 o'clock, uses x N-1Deduct OffsetX, obtain the X of polygonal second two-dimentional apex coordinate 2, use z N-1Deduct OffsetZ, obtain the Z of polygonal first two-dimentional apex coordinate 2
The 3rd apex coordinate computing unit 1 is used at slope smaller or equal to 1, more than or equal to negative 1 o'clock, uses x nAdd OffsetX, obtain the X of polygonal the 3rd two-dimentional apex coordinate 3, use z nAdd OffsetZ, obtain the Z of polygonal the 3rd two-dimentional apex coordinate 3
The 4th apex coordinate computing unit 1 is used at slope smaller or equal to 1, more than or equal to negative 1 o'clock, uses x nDeduct OffsetX, obtain the X of polygonal the 4th two-dimentional apex coordinate 4, use z nDeduct OffsetZ, obtain the Z of polygonal the 4th two-dimentional apex coordinate 4
The first apex coordinate computing unit 2 is used at slope greater than 1, less than negative 1 o'clock, uses x N-1Deduct OffsetX, obtain the X of polygonal first two-dimentional apex coordinate 1, use z N-1Deduct OffsetZ, obtain the Z of polygonal first two-dimentional apex coordinate 1
The second apex coordinate computing unit 2 is used at slope greater than 1, less than negative 1 o'clock, uses x N-1Add OffsetX, obtain the X of polygonal second two-dimentional apex coordinate 2, use z N-1Add OffsetZ, obtain the Z of polygonal first two-dimentional apex coordinate 2
The 3rd apex coordinate computing unit 2 is used at slope greater than 1, less than negative 1 o'clock, uses x nDeduct OffsetX, obtain the X of polygonal the 3rd two-dimentional apex coordinate 3, use z nDeduct OffsetZ, obtain the Z of polygonal the 3rd two-dimentional apex coordinate 3
The 4th apex coordinate computing unit 2 is used at slope greater than 1, less than negative 1 o'clock, uses x nAdd OffsetX, obtain the X of polygonal the 4th two-dimentional apex coordinate 4, use z nAdd OffsetZ, obtain the Z of polygonal the 4th two-dimentional apex coordinate 4
More than the 3D line drawing method and the device that provide for the embodiment of the invention, seeing also Fig. 3 is the 3D line drawing design sketch that adopts embodiment of the invention technical scheme to obtain, and can see intuitively that from this figure lines have smooth connection between the 3D transparent effect section.
More than the method for drafting and the device of a kind of 3D lines provided by the present invention is described in detail, for one of ordinary skill in the art, thought according to the embodiment of the invention, part in specific embodiments and applications all can change, in sum, this description should not be construed as limitation of the present invention.

Claims (10)

1. 3D lines method for drafting is characterized in that described method comprises:
With a n-1 in the three-dimensional vertices set of coordinates that presets and n three-dimensional vertices coordinate projection to the XZ plane, obtain n-1 with the individual two-dimentional apex coordinate of n;
According to the straight line of n-1 and n two-dimentional apex coordinate formation and the angle of X-axis, and given live width, polygonal four two-dimentional apex coordinates calculated;
Described polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates, fill the polygon that constitutes by four three-dimensional vertices coordinates, obtain n-1 bar line segment; Wherein, n is the natural number more than or equal to 2.
2. the method for claim 1 is characterized in that, if the straight line parallel of n-1 and n two-dimentional apex coordinate formation then calculates polygonal four two-dimentional apex coordinates and specifically comprises in X-axis:
The x value of n-1 two-dimentional apex coordinate is composed X to polygonal first and second two-dimentional apex coordinate;
Add half of given live width with the z value of n-1 two-dimentional apex coordinate, obtain the Z value of polygonal first two-dimentional apex coordinate;
Deduct half of given live width with the z value of n-1 two-dimentional apex coordinate, obtain the Z value of polygonal second two-dimentional apex coordinate;
The x value of n two-dimentional apex coordinate is composed the X that gives polygonal the 3rd and the 4th two-dimentional apex coordinate;
Add half of given live width with the z value of n two-dimentional apex coordinate, obtain the Z value of polygonal the 3rd two-dimentional apex coordinate;
Deduct half of given live width with the z value of n two-dimentional apex coordinate, obtain the Z value of polygonal the 4th two-dimentional apex coordinate.
3. the method for claim 1 is characterized in that, and is described if the straight line of n-1 and n two-dimentional apex coordinate formation perpendicular to X-axis, then calculates polygonal four two-dimentional apex coordinates and specifically comprises:
The z value of n-1 two-dimentional apex coordinate is composed Z to polygonal first and second two-dimentional apex coordinate;
Add half of given live width with the x value of n-1 two-dimentional apex coordinate, obtain the X value of polygonal first two-dimentional apex coordinate;
Deduct half of given live width with the x value of n-1 two-dimentional apex coordinate, obtain the X value of polygonal second two-dimentional apex coordinate;
The z value of n two-dimentional apex coordinate is composed the Z that gives polygonal the 3rd and the 4th two-dimentional apex coordinate;
Add half of given live width with the x value of n two-dimentional apex coordinate, obtain the X value of polygonal the 3rd two-dimentional apex coordinate;
Deduct half of given live width with the x value of n two-dimentional apex coordinate, obtain the X value of polygonal the 4th two-dimentional apex coordinate.
4. the method for claim 1 is characterized in that, if described straight line individual as if n-1 and that the individual two-dimentional apex coordinate of n constitutes both had been not orthogonal to X-axis, also is not parallel to X-axis, then calculates polygonal four two-dimentional apex coordinates and specifically comprises:
Calculate the straight line of n-1 and n two-dimentional apex coordinate formation and the angle theta of X-axis;
Multiply by half of given live width with the absolute value of sin θ, obtain the X-axis side-play amount;
Multiply by half of given live width with the absolute value of cos θ, obtain Z axle offset amount;
Judge the quadrant at angle theta place, according to the quadrant at angle theta place, n-1 and the individual two-dimentional apex coordinate of n and X-axis side-play amount and Z axle offset amount are calculated polygonal four two-dimentional apex coordinates.
5. method as claimed in claim 4 is characterized in that, if described 0 °<angle theta<90 ° or 180 °<angle theta<270 °, then calculate polygonal four two-dimentional apex coordinates and specifically comprise:
X value with n-1 two-dimentional apex coordinate deducts the X-axis side-play amount, obtains the X of polygonal first two-dimentional apex coordinate;
Z value with n-1 two-dimentional apex coordinate adds Z axle offset amount, obtains the Z value of polygonal first two-dimentional apex coordinate;
X value with n-1 two-dimentional apex coordinate adds the X-axis side-play amount, obtains the X value of polygonal second two-dimentional apex coordinate;
Z value with n-1 two-dimentional apex coordinate deducts Z axle offset amount, obtains the Z value of polygonal first two-dimentional apex coordinate;
X value with n two-dimentional apex coordinate deducts the X-axis side-play amount, obtains the X of polygonal the 3rd two-dimentional apex coordinate;
Z value with n two-dimentional apex coordinate adds Z axle offset amount, obtains the Z value of polygonal the 3rd two-dimentional apex coordinate;
X value with n two-dimentional apex coordinate adds the X-axis side-play amount, obtains the X value of polygonal the 4th two-dimentional apex coordinate;
Z value with n two-dimentional apex coordinate deducts Z axle offset amount, obtains the Z value of polygonal the 4th two-dimentional apex coordinate.
6. method as claimed in claim 4 is characterized in that, if described 90 °<angle theta<180 ° or 270 °<angle theta<360 °, then calculate polygonal four two-dimentional apex coordinates and specifically comprise:
Whether judge described n-1 and n the slope that two-dimentional apex coordinate constitutes straight line smaller or equal to 1, more than or equal to negative 1, if, then
X value with n-1 two-dimentional apex coordinate adds the X-axis side-play amount, obtains the X of polygonal first two-dimentional apex coordinate;
Z value with n-1 two-dimentional apex coordinate adds Z axle offset amount, obtains the Z value of polygonal first two-dimentional apex coordinate;
X value with n-1 two-dimentional apex coordinate deducts the X-axis side-play amount, obtains the X value of polygonal second two-dimentional apex coordinate;
Z value with n-1 two-dimentional apex coordinate deducts Z axle offset amount, obtains the Z value of polygonal first two-dimentional apex coordinate;
X value with n two-dimentional apex coordinate adds the X-axis side-play amount, obtains the X of polygonal the 3rd two-dimentional apex coordinate;
Z value with n two-dimentional apex coordinate adds Z axle offset amount, obtains the Z value of polygonal the 3rd two-dimentional apex coordinate;
X value with n two-dimentional apex coordinate deducts the X-axis side-play amount, obtains the X value of polygonal the 4th two-dimentional apex coordinate;
Z value with n two-dimentional apex coordinate deducts Z axle offset amount, obtains the Z value of polygonal the 4th two-dimentional apex coordinate;
If not, then
X value with n-1 two-dimentional apex coordinate deducts the X-axis side-play amount, obtains the X of polygonal first two-dimentional apex coordinate;
Z value with n-1 two-dimentional apex coordinate deducts Z axle offset amount, obtains the Z value of polygonal first two-dimentional apex coordinate;
X value with n-1 two-dimentional apex coordinate adds the X-axis side-play amount, obtains the X value of polygonal second two-dimentional apex coordinate;
Z value with n-1 two-dimentional apex coordinate adds Z axle offset amount, obtains the Z value of polygonal first two-dimentional apex coordinate;
X value with n two-dimentional apex coordinate deducts the X-axis side-play amount, obtains the X value of polygonal the 3rd two-dimentional apex coordinate;
Z value with n two-dimentional apex coordinate deducts Z axle offset amount, obtains the Z value of polygonal the 3rd two-dimentional apex coordinate;
X value with n two-dimentional apex coordinate adds the X-axis side-play amount, obtains the X value of polygonal the 4th two-dimentional apex coordinate;
Z value with n two-dimentional apex coordinate adds Z axle offset amount, obtains the Z value of polygonal the 4th two-dimentional apex coordinate.
7. as the described method of each claim in the claim 1 to 6, it is characterized in that if n 〉=3, then after obtaining described n-1 bar line segment, described method further comprises:
The polygon that four three-dimensional vertices coordinates that the n-2 line segment that filling has obtained is adjacent with n-1 bar line segment constitute makes n-2 line segment and the smooth connection of n-1 bar line segment.
8. 3D lines drawing apparatus is characterized in that described device comprises:
The two-dimensional coordinate projecting cell is used for n-1 of the three-dimensional vertices set of coordinates that will preset and n three-dimensional vertices coordinate projection to the XZ plane, obtain n-1 with the individual two-dimentional apex coordinate of n;
The apex coordinate computing unit is used for according to the straight line of n-1 and n two-dimentional apex coordinate formation and the angle of X-axis, and given live width, calculates polygonal four two-dimentional apex coordinates;
The three-dimensional coordinate reduction unit is used for described polygonal four two-dimentional apex coordinates are reduced to four three-dimensional vertices coordinates;
The lines drawing unit is used to fill the polygon that is made of four three-dimensional vertices coordinates, obtains n-1 bar line segment; Wherein, n is the natural number more than or equal to 2.
9. device as claimed in claim 8 is characterized in that, if n 〉=3, then described device further comprises:
Connect the line segment drawing unit, be used to fill the polygon that n-2 line segment four the three-dimensional vertices coordinates adjacent with n-1 bar line segment that obtained constitute, make n-2 line segment and the smooth connection of n-1 bar line segment.
10. device as claimed in claim 8 or 9 is characterized in that, if n-1 and n the straight line parallel that two-dimentional apex coordinate constitutes be in X-axis, then described apex coordinate computing unit specifically comprises:
First and second summit computing unit is used for the x value of n-1 two-dimentional apex coordinate is composed X to polygonal first and second two-dimentional apex coordinate; Add half of given live width with the z value of n-1 two-dimentional apex coordinate, obtain the Z value of polygonal first two-dimentional apex coordinate; Deduct half of given live width with the z value of n-1 two-dimentional apex coordinate, obtain the Z value of polygonal second two-dimentional apex coordinate;
Second and third summit computing unit is used for the x value of n two-dimentional apex coordinate is composed the X that gives polygonal the 3rd and the 4th two-dimentional apex coordinate; Add half of given live width with the z value of n two-dimentional apex coordinate, obtain the Z value of polygonal the 3rd two-dimentional apex coordinate; Deduct half of given live width with the z value of n two-dimentional apex coordinate, obtain the Z value of polygonal the 4th two-dimentional apex coordinate.
CN200910258952.2A 2009-12-31 2009-12-31 Method and device for rendering three-dimensional lines Expired - Fee Related CN102117501B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910258952.2A CN102117501B (en) 2009-12-31 2009-12-31 Method and device for rendering three-dimensional lines

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910258952.2A CN102117501B (en) 2009-12-31 2009-12-31 Method and device for rendering three-dimensional lines

Publications (2)

Publication Number Publication Date
CN102117501A true CN102117501A (en) 2011-07-06
CN102117501B CN102117501B (en) 2014-06-11

Family

ID=44216253

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910258952.2A Expired - Fee Related CN102117501B (en) 2009-12-31 2009-12-31 Method and device for rendering three-dimensional lines

Country Status (1)

Country Link
CN (1) CN102117501B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102800119A (en) * 2012-06-13 2012-11-28 天脉聚源(北京)传媒科技有限公司 Animation display method and device of three-dimensional curve
CN104077790A (en) * 2013-03-29 2014-10-01 百度在线网络技术(北京)有限公司 Method and system for drawing mode string
CN106846490A (en) * 2017-02-09 2017-06-13 腾讯科技(深圳)有限公司 A kind of cambered surface model generating method and device
CN111784795A (en) * 2020-06-01 2020-10-16 北京像素软件科技股份有限公司 Processing method and device for line segment aliasing, electronic equipment and storage medium
WO2022143055A1 (en) * 2020-12-30 2022-07-07 广东三维家信息科技有限公司 Line width adjustment method and apparatus, computer device, and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100476878C (en) * 2005-12-28 2009-04-08 腾讯科技(深圳)有限公司 Interactive ink and wash style real-time 3D romancing and method for realizing cartoon
US7580035B2 (en) * 2006-12-28 2009-08-25 Intel Corporation Real-time collision detection using clipping

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102800119A (en) * 2012-06-13 2012-11-28 天脉聚源(北京)传媒科技有限公司 Animation display method and device of three-dimensional curve
WO2013185516A1 (en) * 2012-06-13 2013-12-19 天脉聚源(北京)传媒科技有限公司 Animation display method and apparatus for three-dimensional curve
CN102800119B (en) * 2012-06-13 2014-08-13 天脉聚源(北京)传媒科技有限公司 Animation display method and device of three-dimensional curve
CN104077790A (en) * 2013-03-29 2014-10-01 百度在线网络技术(北京)有限公司 Method and system for drawing mode string
CN106846490A (en) * 2017-02-09 2017-06-13 腾讯科技(深圳)有限公司 A kind of cambered surface model generating method and device
WO2018145568A1 (en) * 2017-02-09 2018-08-16 腾讯科技(深圳)有限公司 Method and device for generating arc surface model
CN106846490B (en) * 2017-02-09 2019-08-27 腾讯科技(深圳)有限公司 A kind of methods of exhibiting and device that cambered surface model is used to be shown in 3D scene
US10861234B2 (en) 2017-02-09 2020-12-08 Tencent Technology (Shenzhen) Company Limited Curved surface model generation method and apparatus
CN111784795A (en) * 2020-06-01 2020-10-16 北京像素软件科技股份有限公司 Processing method and device for line segment aliasing, electronic equipment and storage medium
WO2022143055A1 (en) * 2020-12-30 2022-07-07 广东三维家信息科技有限公司 Line width adjustment method and apparatus, computer device, and storage medium

Also Published As

Publication number Publication date
CN102117501B (en) 2014-06-11

Similar Documents

Publication Publication Date Title
CN104183005B (en) Graphics processing unit and rendering intent based on segment
CN102117501B (en) Method and device for rendering three-dimensional lines
CN104183016B (en) A kind of construction method of quick 2.5 dimension building model
CN104898947B (en) A kind of method that GDI electronics map vector scaling and translation are realized based on mouse position
CN105913478A (en) 360-degree panorama display method and display module, and mobile terminal
CN103984720B (en) Tile map creation method and device based on OpenGL
CN105556571A (en) Using compute shaders as front end for vertex shaders
CN105574931A (en) Electronic map road drawing method and device
CN106683189A (en) Method of rendering text in three-dimensional scene
CN109255832A (en) A kind of target light field creation method based on OpenGL
CN103632390A (en) Method for realizing naked eye 3D (three dimensional) animation real-time making by using D3D (Direct three dimensional) technology
US6677953B1 (en) Hardware viewport system and method for use in a graphics pipeline
CN104463937B (en) Animation producing method and device based on irregularly shaped object
CN102027508B (en) For using texture to show the system and method for 3 dimension maps
US9299185B2 (en) Enhanced system and method for rendering visual surface
Nah et al. MobiRT: an implementation of OpenGL ES-based CPU-GPU hybrid ray tracer for mobile devices
CN106803279A (en) It is a kind of to optimize the method for drawing sky
CN103310409A (en) Quick triangle partitioning method of Tile-based rendering architecture central processing unit (CPU)
CN108053751B (en) Method and device for drawing direction arrow on electronic map navigation route
CN108022309A (en) Threedimensional model intelligent connecting method
CN103679794A (en) Drawing method of simulated three-dimensional sketching pencil drawing
CN106600698B (en) A kind of fast drawing method of threedimensional model
CN201540593U (en) Mutual information generating system
JP2011514583A (en) Contact simulation method and apparatus using layered depth images
CN103985150B (en) A kind of image processing method and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200515

Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Alibaba (China) Co.,Ltd.

Address before: 59 No. 701, 361008, hope road, Xiamen Software Park, Fujian, China

Patentee before: AUTONAVI SOFTWARE Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140611

Termination date: 20201231