CN100468460C - Drawing method and apparatus thereof - Google Patents

Drawing method and apparatus thereof Download PDF

Info

Publication number
CN100468460C
CN100468460C CNB2005100738473A CN200510073847A CN100468460C CN 100468460 C CN100468460 C CN 100468460C CN B2005100738473 A CNB2005100738473 A CN B2005100738473A CN 200510073847 A CN200510073847 A CN 200510073847A CN 100468460 C CN100468460 C CN 100468460C
Authority
CN
China
Prior art keywords
distance
plane
pixel
projection plane
buffer
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.)
Active
Application number
CNB2005100738473A
Other languages
Chinese (zh)
Other versions
CN1687971A (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.)
Via Technologies Inc
Original Assignee
Via Technologies Inc
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 Via Technologies Inc filed Critical Via Technologies Inc
Priority to CNB2005100738473A priority Critical patent/CN100468460C/en
Publication of CN1687971A publication Critical patent/CN1687971A/en
Application granted granted Critical
Publication of CN100468460C publication Critical patent/CN100468460C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention is a drawing method, firstly calculating a distance between a user defined cutting plane and a projecting plane so as to set a buffer; calculating a distance between the top point of a triangle and the projecting plane so as to calculate a distance between a pixel point in the triangle and the projecting plane; comparing the distance between the pixel point and the projecting plane with a corresponding value in the buffer: if the former is larger, do not draw the pixel point.

Description

Drawing practice and device thereof
Technical field
The present invention is relevant for drawing practice, and is particularly to a kind of user's of being used for definition and cuts out plane (User-Defined Clip Plane, drawing practice UDCP) and device thereof.
Background technology
In the space, different polygons will be projected to a projection plane, shows on screen as projection plane.When a plurality of polygons were projected to same screen pixel on the projection plane simultaneously, then nearest apart from projection plane, promptly nearest apart from viewpoint polygon will be shown on the projection plane.Fig. 1 is a synoptic diagram, and it represents Z-buffer (Z-Buffer) principle.The Z-buffer is in order to the distance apart from projection plane when the screen pixels of polygon projection in the space relatively.Represent that as Fig. 1 three polygons (101,102 and 103) are arranged in the space, wherein polygon (101,102 and 103) go up to divide the pixel that other pixel (I, J and K) projection simultaneously drops on projection plane 100 (x, y) on.With (x, y) the plane equation formula of difference substitution polygon (101,102 and 103) can obtain the distance of polygon (101,102 and 103) to projection plane 100 respectively, i.e. the Z value.By comparing the Z value on each plane, can find that polygon 101 is nearest apart from projection plane 100, therefore, (x y) goes up the color that must show pixel I on the polygon 101 to the pixel of projection plane 100.
In addition, in Drawing Design, the user can define the specific plane of cutting out voluntarily and check the object structures under different sections or the drafting scope of restriction object.For instance, Fig. 2 represents a 3D rectangle 200.When a rectangle 200 by the user of a forward direction (Face Forward) definition cut out plane 300 cut out-of-date, as shown in Figure 3, then rectangle 200 is cut into user definition and cuts out before the plane 300 checkable a part of 210 and cut out the part 220 that can't check behind the plane 300 with user's definition.What note is, forward direction user definition is cut out the object of representing to cut out before the plane in the plane and can be examined, and the object of cutting out behind the plane can't be checked.Then the object of cutting out after the plane is represented to cut out the plane to (Face Backward) user definition can be examined, and the object of cutting out before the plane can't be checked.
For the triangle that a desire is drawn, known method must calculate the plane is cut out on leg-of-mutton each summit to user's definition distance.The distance of utilizing each summit to user definition to cut out the plane again comes interpolation to obtain each pixel in the triangle is cut out the plane to user's definition distance.At last, if the distance that pixel is cut out the plane to user's definition is a negative value, promptly represents this pixel to be positioned at user's definition and cut out tossing about of plane, then this pixel is dropped, and is not drawn.Fig. 4 is a synoptic diagram, and the drawing practice on plane is cut out in the known user's of the being used for definition of its expression.As shown in the figure, if a triangle comprises A, B and three summits of C, then can be respectively come unit distance poor (dx and dy) between calculating pixel to what plane UDCP was cut out in user's definition apart from dA, dB and dC, and utilize unit distance and vertex position to come interpolation to obtain each pixel (P1, P2 and Pk) to define the distance of cutting out plane UDCP to the user according to A, B and C.In this example, suppose that it is that a forward is cut out the plane that plane UDCP is cut out in user's definition, then pixel P1 and P2 will be drawn.In addition, because the distance that pixel Pk cuts out plane UDCP to user definition is a negative value, then pixel Pk will can be not drawn.
In known drawing course, because the value of each summit and interior pixels point all must be calculated its distance of cutting out the plane to projection plane and user's definition respectively, when having a plurality of users' definition simultaneously when cutting out the plane, then must spend many resources and carry out correlation computations, thereby reduce the efficient of whole plotter program.
Summary of the invention
In view of this, the invention provides a kind of user's of being used for definition and cut out the drawing practice and the device thereof on plane.
According to the drawing practice of the embodiment of the invention, at first, calculate the distance that plane to a projection plane is cut out in user definition, and according to this distance setting one buffer.Calculate the distance of a vertex of a triangle to projection plane, and according to the summit to the distance calculation triangle of projection plane a pixel to the distance of projection plane.Pixel corresponding value to the distance of projection plane and the buffer is compared.If pixel is not drawn pixel to the distance of projection plane during greater than the value in the buffer.
Drawing practice according to the embodiment of the invention, at first, calculate the distance that plane to a projection plane is cut out in one first user definition, and according to distance setting one first buffer, and calculate one second user definition and cut out the distance of plane, and according to distance setting one second buffer to projection plane.Afterwards, calculate the distance of leg-of-mutton a plurality of summits to projection plane, and according to the summit to the distance calculation triangle of projection plane a pixel to the distance of projection plane.Pixel corresponding one first value to the distance of projection plane and first buffer is compared.If pixel when the distance of projection plane is worth greater than first in first buffer, is not drawn pixel.Pixel corresponding one second value to the distance of projection plane and second buffer is compared.If pixel when the distance of projection plane is worth less than second in second buffer, is not drawn pixel
Said method of the present invention can be included in tangible media by program code means.When program code was loaded and carries out by machine, machine became in order to carry out device of the present invention.
According to plotting unit of the present invention, comprising: one first device, define the distance of cutting out plane to a projection plane in order to calculate one first user, and according to this distance setting one first buffer; One second device, in order to calculating the distance of one first leg-of-mutton a plurality of summits to this projection plane, and according to these a plurality of summits to this first triangle of distance calculation of this projection plane one first pixel to the distance of this projection plane; And one the 3rd the device, in order to this first pixel corresponding one first value to the distance of this projection plane and this first buffer is compared, and if this first pixel is not drawn this first pixel to the distance of this projection plane during greater than this first value in this first buffer.
Description of drawings
For above-mentioned purpose of the present invention, feature and advantage can be become apparent, embodiment cited below particularly, and conjunction with figs., it is as follows to be elaborated.
Fig. 1 is a synoptic diagram, and it represents a Z-buffer principle.
Fig. 2 represents a 3D rectangle.
Cut out the 3D rectangle of cutting on the plane by user definition in Fig. 3 presentation graphs 2.
Fig. 4 is a synoptic diagram, and the drawing practice on plane is cut out in the known user's of the being used for definition of its expression.
Fig. 5 is a synoptic diagram, and its expression is according to the device of the embodiment of the invention.
Fig. 6 is a process flow diagram, and its expression is according to the drawing practice of the embodiment of the invention.
Symbol description
The 100-projection plane; 101,102,103-polygon; I, J, K-pixel; The 200-rectangle; 210-can check rectangle; 220-can not check rectangle; 300, the plane is cut out in UDCP-user's definition; A, B, C-summit; P1, P2, Pk-pixel; DA, dB, dC-distance; The 500-device; 510-vertex coloring engine; 520-assembles engine; The original engine of 530-; The painted engine of 540-pixel; The 550-engine that happens suddenly; S601, S602 ..., the S610-operation steps.
Embodiment
Fig. 5 is a synoptic diagram, and its expression is according to the device of the embodiment of the invention.
Device 500 according to the embodiment of the invention comprises a vertex coloring engine (Vertex ShaderEngine, VSE) 510, one assembling engine (Setup Engine, SE) 520, one original engine (PrimitiveEngine, PE) the painted engine of 530, one pixel (Pixel Shader Engine, PSE) 540, with burst engine (Burst Engine, BE) 550.
Vertex coloring engine 510 calculates the distance of each vertex of a triangle to one projection plane in the object.Vertex coloring engine 510 also calculates each vertex of a triangle in the object is cut out the plane to all users' definition distance.It should be noted that, vertex coloring engine 510 can be cut out a Sign Bit (Sign Bit) of the distance on plane by calculating a vertex of a triangle to user's definition, and judges whether to draw triangle according to the corresponding respectively Sign Bit in each summit.In one embodiment, when all corresponding Sign Bits of summit institute all were negative value in the triangle, then this triangle can be ignored, and does not carry out subsequent treatment.Assembling engine 520 is according to vertex of a triangle unit distance poor (dx and dy) between pixel to the distance calculation triangle of projection plane.Original engine 530 utilizes unit distance difference and vertex position to come interpolation to obtain in the triangle each pixel to the distance of projection plane.The painted engine 540 of pixel is in order to comparing pixel to the distance of projection plane and value in two buffers, do not need the pixel drawn to filter out some.550 in engine of burst is drawn remaining pixel.It should be noted that in complete plotting unit vertex coloring engine 510, assembling engine 520, original engine 530, the painted engine 540 of pixel also have other function and operation separately with burst engine 550, are not limited thereto.
In addition, two buffers comprise a hither plane (Near Plane) buffer and a far plane (Far Plane) buffer (not expression among Fig. 5).In one embodiment, the size of hither plane buffer and far plane buffer equals the size of screen.The hither plane buffer according to the back to user definition cut out plane to the distance of projection plane and set.As a plurality of back to user's definition when cutting out the plane, then in the hither plane buffer in the homolographic projection plane value of a projected pixel can be set at the distance of cutting out corresponding pixel on the plane apart from projection plane user's definition farthest.The far plane buffer is cut out plane to the distance of projection plane according to user's definition of forward direction and is set.When the plane is cut out in the user of a plurality of forward directions definition, then in the far plane buffer in the homolographic projection plane value of a projected pixel can be set at the distance that corresponding pixel on the plane is cut out in the user definition nearest apart from projection plane.It should be noted that in drawing course the far plane buffer is the Z-buffer, in other words, the far plane buffer will upgrade according to Z-buffer principle, and the details of Z-buffer principle is omitted at this.
Fig. 6 is a process flow diagram, and its expression is according to the drawing practice of the embodiment of the invention.What note is, only describes with a triangle of an object in this embodiment.Other triangle of object can be operated and computing according to same way as.
At first, as step S601, cut out the plane according to user's definition and set hither plane and far plane buffer.Wherein, the hither plane buffer according to the back to user definition cut out plane to the distance of projection plane and set.As a plurality of back to user's definition when cutting out the plane, then in the hither plane buffer in the homolographic projection plane value of a projected pixel can be set at the distance of cutting out corresponding pixel on the plane apart from projection plane user's definition farthest.What note is, when not have the back to the user define when cutting out the plane, then the value in the hither plane buffer can be set at 0.In addition, the far plane buffer is cut out plane to the distance of projection plane according to the user of forward direction definition and is set.When the plane is cut out in the user of a plurality of forward directions definition, then in the far plane buffer in the homolographic projection plane value of a projected pixel can be set at the distance that corresponding pixel on the plane is cut out in the user definition nearest apart from projection plane.What note is that when the plane was cut out in the user's definition that does not have forward direction, then the value in the far plane buffer can be set at 1.
As step S602, calculate vertex of a triangle is cut out the plane to projection plane and each user definition distance respectively.What note is that the distance that the plane is cut out in calculating summit to user's definition can be to calculate the Sign Bit of this distance.Afterwards, as step S603, judge whether the distance that the plane is cut out to user's definition in the summit all is negative value.In other words, judge that the user the definition whether summit all is positioned at forward direction cuts out after the plane, or the back to user's definition cut out the plane before.If, as step S604, abandon this triangle, do not draw.If not, as step S605, utilize interpolation method to calculate in the triangle each pixel to the distance of projection plane according to summit to the distance of projection plane.At each pixel, as step S606, judge pixel to the distance of projection plane whether greater than value accordingly in the far plane buffer.If, as step S607, abandon this pixel, do not draw.If not, as step S608, judge pixel to the distance of projection plane whether less than value accordingly in the hither plane buffer.If, as step S607, abandon this pixel, do not draw.If not, as step S609, judge whether that pixels all in the triangle all checked.If not, flow process is got back to step S606, continues to check the one other pixel point.If, draw remaining pixel in the triangle as step S610.The attention of value be, in drawing course, the far plane buffer will upgrade according to Z-buffer principle, and according to Z-buffer principle, is projected in the different pixels point of same projection pixel, the pixel of close projection plane can be drawn.
Method and system of the present invention, or particular type or wherein partly, can be contained in tangible media with the type of program code, get (as embodied on computer readable) Storage Media as floppy disk, CD, hard disk or any other machine readable, wherein, when program code by machine, when loading and carrying out as computing machine, this machine becomes in order to participate in device of the present invention.Method and apparatus of the present invention also can be with the program code type by some transfer mediums, transmit as electric wire or cable, optical fiber or any transport-type, wherein, when program code by machine, when receiving, loading and carrying out as computing machine, this machine becomes in order to participate in device of the present invention.When the general service processor is practical, the program code associative processor provides a class of operation to be similar to the unique apparatus of using particular logic circuit.
Though the present invention with preferred embodiment openly as above; right its is not that any those skilled in the art are under the situation that does not break away from the spirit and scope of the present invention in order to qualification the present invention; can change and modification, so protection scope of the present invention is as the criterion with the claim institute restricted portion that is proposed.

Claims (13)

1. a drawing practice comprises the following steps:
Calculate the distance that plane to a projection plane is cut out in one first user definition, and according to this distance setting one first buffer;
Calculate the distance of one first leg-of-mutton a plurality of summits to this projection plane, and according to these a plurality of summits to this first triangle of distance calculation of this projection plane one first pixel to the distance of this projection plane;
This first pixel corresponding one first value to the distance of this projection plane and this first buffer is compared; And
If this first pixel is not drawn this first pixel to the distance of this projection plane during greater than this first value in this first buffer.
2. drawing practice as claimed in claim 1 also comprises the following steps:
Calculate one second user definition and cut out the distance of plane to this projection plane, and according to this distance setting one second buffer;
This first pixel corresponding one second value to the distance of this projection plane and this second buffer is compared; And
If this first pixel is not drawn this first pixel to the distance of this projection plane during less than this second value in this second buffer.
3. drawing practice as claimed in claim 1 also comprises the following steps:
Calculate the plane is cut out on each these a plurality of summit to this first user definition distance; And
If when the distance that the plane is cut out to this first user definition in each these a plurality of summit is all negative value, do not draw this first triangle.
4. drawing practice as claimed in claim 3, wherein calculating the distance of cutting out the plane to this first user definition in each these a plurality of summit comprises: calculate each these a plurality of summit to this first user definition and cut out a Sign Bit of the distance on plane, and corresponding respectively this Sign Bit in these a plurality of summits judges whether to draw this first triangle according to each.
5. drawing practice as claimed in claim 1 also comprises according to these a plurality of summits to the distance of this projection plane and utilizes an interpolation method to calculate the distance of this first pixel to this projection plane.
6. drawing practice as claimed in claim 1 also comprises
Calculate one the 3rd user definition and cut out in the plane one second pixel to the distance of this projection plane; And
If this second pixel to the distance of this projection plane less than in this first buffer during corresponding this first value, this first value is set at the distance of this second pixel to this projection plane.
7. drawing practice as claimed in claim 2 also comprises the following steps:
Calculate the plane is cut out on each these a plurality of summit to this first user definition distance; And
If when the distance that the plane is cut out to this first user definition in each these a plurality of summit is all negative value, do not draw this first triangle.
8. drawing practice as claimed in claim 7, wherein calculating the distance of cutting out the plane to this first user definition in each these a plurality of summit comprises: calculate each these a plurality of summit to this first user definition and cut out a Sign Bit of the distance on plane, and corresponding respectively this Sign Bit in these a plurality of summits judges whether to draw this first triangle according to each.
9. drawing practice as claimed in claim 2 also comprises the following steps:
Calculate the distance of one second leg-of-mutton a plurality of summits to this projection plane, and according to these a plurality of summits to this second triangle of distance calculation of this projection plane at least one second pixel to the distance of this projection plane; And
If this second pixel to the distance of this projection plane less than in this first buffer during corresponding this first value, this first value is set at the distance of this second pixel to this projection plane.
10. plotting unit comprises:
One first device defines the distance of cutting out plane to a projection plane in order to calculate one first user, and according to this distance setting one first buffer;
One second device, in order to calculating the distance of one first leg-of-mutton a plurality of summits to this projection plane, and according to these a plurality of summits to this first triangle of distance calculation of this projection plane one first pixel to the distance of this projection plane; And
One the 3rd device, in order to this first pixel corresponding one first value to the distance of this projection plane and this first buffer is compared, and if this first pixel is not drawn this first pixel to the distance of this projection plane during greater than this first value in this first buffer.
11. plotting unit as claimed in claim 10 also comprises:
One the 4th device is cut out the distance of plane to this projection plane in order to calculate one second user definition, and according to this distance setting one second buffer; And
One the 5th device, in order to this first pixel corresponding one second value to the distance of this projection plane and this second buffer is compared, and if this first pixel is not drawn this first pixel to the distance of this projection plane during less than this second value in this second buffer.
12. plotting unit as claimed in claim 10 also comprises:
One the 6th device is in order to calculate the plane is cut out on each these a plurality of summit to this first user definition distance; And
One the 7th device when being all negative value in order to the distance of cutting out the plane to this first user definition as if each these a plurality of summit, is not drawn this first triangle.
13. plotting unit as claimed in claim 10 also comprises:
One the 8th device is cut out in the plane one second pixel to the distance of this projection plane in order to calculate one the 3rd user definition; And
One the 9th device, in order to if this second pixel to the distance of this projection plane less than in this first buffer during corresponding this first value, this first value is set at the distance of this second pixel to this projection plane.
CNB2005100738473A 2005-05-25 2005-05-25 Drawing method and apparatus thereof Active CN100468460C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005100738473A CN100468460C (en) 2005-05-25 2005-05-25 Drawing method and apparatus thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005100738473A CN100468460C (en) 2005-05-25 2005-05-25 Drawing method and apparatus thereof

Publications (2)

Publication Number Publication Date
CN1687971A CN1687971A (en) 2005-10-26
CN100468460C true CN100468460C (en) 2009-03-11

Family

ID=35306012

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005100738473A Active CN100468460C (en) 2005-05-25 2005-05-25 Drawing method and apparatus thereof

Country Status (1)

Country Link
CN (1) CN100468460C (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100568289C (en) * 2007-07-13 2009-12-09 威盛电子股份有限公司 Computer drawing element describing method and device
CN101261744B (en) * 2008-03-27 2010-10-13 威盛电子股份有限公司 Protection belt cutting system and method for plot processor

Also Published As

Publication number Publication date
CN1687971A (en) 2005-10-26

Similar Documents

Publication Publication Date Title
CN111860304B (en) Image labeling method, electronic device, equipment and storage medium
TWI278788B (en) Z-buffering techniques for graphics rendering
CN103491188B (en) Virtual desktop and GPU is utilized thoroughly to pass the method realizing multiple users share graphics workstation
CN109242903A (en) Generation method, device, equipment and the storage medium of three-dimensional data
EP4020385A1 (en) Method for training image depth estimation model and method for processing image depth information
CN102439862A (en) Ray tracing device and method
CN105678836A (en) Rendering 3D video images on a stereo-enabled display
US11967132B2 (en) Lane marking detecting method, apparatus, electronic device, storage medium, and vehicle
CN112306439B (en) One-machine multi-screen interaction system and management method thereof, electronic equipment and storage medium
CN109194736A (en) Message De-weight method, device, electronic equipment, medium and unmanned vehicle
CN109376053A (en) Data processing method, device and mobile terminal
CN111539345A (en) Method, device, equipment and readable storage medium for determining lane change action
CN109920056A (en) Building rendering method, device, equipment and medium
CN104065953A (en) Method and device based on display apparatus multi-view visual display control
CN100468460C (en) Drawing method and apparatus thereof
KR20220056832A (en) Method and apparatus for pushing information, electronic device , computer readable storage medium and computer program
CN110109594A (en) A kind of draw data sharing method, device, storage medium and equipment
CN110244885A (en) Input method, device, equipment and storage medium
CN107547451A (en) A kind of multipath server, CPU connection methods and device
CN105817031A (en) Game map object drawing method and device
CN108510740A (en) Report the method for digging and device of road conditions by mistake
CN110089076A (en) The method and apparatus for realizing information interaction
CN107944448A (en) A kind of image asynchronous edit methods and device
CN107885809A (en) A kind of document transmission method, device, Intelligent flat and storage medium
US7034837B2 (en) Method, system, and computer program product for determining a structure of a graphics compositor tree

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