WO2019000692A1 - Three-dimensional graphic rendering method, apparatus, device, and storage medium - Google Patents

Three-dimensional graphic rendering method, apparatus, device, and storage medium Download PDF

Info

Publication number
WO2019000692A1
WO2019000692A1 PCT/CN2017/104816 CN2017104816W WO2019000692A1 WO 2019000692 A1 WO2019000692 A1 WO 2019000692A1 CN 2017104816 W CN2017104816 W CN 2017104816W WO 2019000692 A1 WO2019000692 A1 WO 2019000692A1
Authority
WO
WIPO (PCT)
Prior art keywords
point
contour
standard
drawn
dimensional
Prior art date
Application number
PCT/CN2017/104816
Other languages
French (fr)
Chinese (zh)
Inventor
叶洪
Original Assignee
广州视源电子科技股份有限公司
广州视睿电子科技有限公司
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 广州视源电子科技股份有限公司, 广州视睿电子科技有限公司 filed Critical 广州视源电子科技股份有限公司
Publication of WO2019000692A1 publication Critical patent/WO2019000692A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/10Constructive solid geometry [CSG] using solid primitives, e.g. cylinders, cubes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/04Indexing scheme for image data processing or generation, in general involving 3D image data

Definitions

  • the present invention relates to the field of graphics technologies, and in particular, to a stereoscopic graphics rendering method, apparatus, device, and storage medium.
  • a solid figure can be understood as a figure formed by projecting a three-dimensional body onto a two-dimensional plane according to a specified projection condition, and can also be understood as a figure drawn by displaying a three-dimensional body at a specific angle of view on a two-dimensional plane.
  • the three-dimensional body may be a cylinder, a cone, two cylinders whose bottom surface is a regular polygon and whose bottom surfaces are parallel.
  • a stereoscopic graphic sample may be pre-stored in the drawing software, and a stereoscopic graphic sample is dragged out from the toolbar of the drawing software according to a user operation instruction to perform position and size adjustment, thereby obtaining a stereoscopic graphic.
  • a three-point method can be used to draw a three-dimensional figure, as shown in FIG. 1.
  • FIG. 1 is a schematic diagram of drawing a cylindrical figure by a two-point method in the related art.
  • P1 and P2 two coordinate points are used as diagonal vertices, and the other two vertex coordinates are determined based on a preset rule, and the size of the cylinder to be drawn is obtained.
  • a cylinder figure is reversed according to the determined rectangle, and the cylinder figure is in the rectangle P1P4P2P3, thereby realizing the drawing of the cylinder figure.
  • the above method has poor response to the operation instruction, and the stereoscopic graphic drawn according to the operation instruction has a gap with the stereoscopic graphic that the user intends to draw, resulting in low accuracy of the drawn stereoscopic graphic.
  • the present invention provides a method, a device, a device and a storage medium for drawing a solid figure, so as to solve the defect that the response effect on the operation instruction is poor, and the accuracy of the drawn three-dimensional figure is low.
  • a method for drawing a solid figure comprising:
  • the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • the standard three-dimensional figure is a graphic that displays a standard three-dimensional body on a two-dimensional plane, and the standard three-dimensional body includes a cylinder, a cone, or two bottom surfaces and two bottom surfaces.
  • a cylinder of the same regular polygon if the standard three-dimensional body is a cylinder or a cone, the side contour is a contour bus; if the standard three-dimensional body is a cylinder with two bottom surfaces parallel and two bottom surfaces being the same regular polygon,
  • the side profile is a side ridgeline.
  • the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure includes: a correspondence between a sample length and a sample angle, and the sample length is a standard solid figure.
  • the length of the line segment formed by the contour point and the center point is specified, and the sample angle is an angle between the line segment and the preset reference line.
  • the determining step of the correspondence between the sample length and the sample angle includes:
  • the projection point corresponding to the point is determined as the specified contour point, and the projection point corresponding to the center is determined as the center point;
  • the first point coordinate and the second point coordinate are respectively used as a center point coordinate and a contour point coordinate of a bottom surface contour in the solid figure to be drawn, and combined with a preset standard three-dimensional figure.
  • the relationship between each specified contour point and the center point on the bottom surface contour determines the first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid graphic, including:
  • each of the specified contour points and the center of the preset standard solid figure has a contour point and a center
  • the relationship of points further includes: drawing information required to draw a bottom surface contour in the standard solid figure; if the standard three-dimensional body is a cylinder or a cone, the drawing information includes the longest contour of the bottom surface in the standard solid figure Radius and length and extension direction of the shortest radius; if the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information includes a center point to a vertex of the bottom surface contour in the standard solid figure Length and direction;
  • the drawing the bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio includes:
  • the bottom surface contour of the stereoscopic graphic to be drawn is drawn by the length obtained by the scaling and the direction in the drawing information.
  • the determining step of the extending direction of the side contour in the standard three-dimensional figure includes:
  • the extending direction of the side contour in the standard solid figure is determined based on the coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and the coordinates of the specified contour point in the lower bottom surface contour.
  • the determining step of extending the side profile in the standard three-dimensional figure includes:
  • the method further includes:
  • the method further includes:
  • a three-dimensional figure of the three-dimensional body at the display viewing angle is drawn.
  • a stereoscopic graphics rendering apparatus comprising:
  • a coordinate acquiring module configured to acquire a first point coordinate, a second point coordinate, and a third point coordinate
  • a ratio determining module configured to respectively use the first point coordinate and the second point coordinate as a center point coordinate and a contour point coordinate of a bottom surface contour in the stereoscopic graphic to be drawn, and combined with each of the preset bottom surface contours of the standard three-dimensional graphic a relationship between the contour point and the center point, determining a first scaling ratio of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics;
  • a graphic drawing module configured to draw a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio; a distance according to the second point coordinate and the third point coordinate, and an extending direction of the side contour in the standard solid graphic, Draw the outline of the other faces in the perspective view to be drawn.
  • an electronic device including:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
  • the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • the electronic device is a smart tablet.
  • a computer storage medium where the program medium includes program instructions, where the program instructions include:
  • first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
  • the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • a bottom surface contour of the three-dimensional graphic is drawn by two points, and other surface contours of the three-dimensional graphic are drawn through the third point, thereby realizing the drawing of the three-dimensional graphic, because the user can control the bottom surface contour of the solid graphic through two points.
  • the size controls the other contours in the solid figure through the third point, so the drawing instructions can be actively responded to draw the three-dimensional graphics that the user desires to draw, thereby improving the accuracy of drawing the stereoscopic graphics.
  • Fig. 1 is a schematic view showing a cylindrical figure drawn by a two-point method in the related art.
  • FIG. 2A is a flowchart of a method for drawing a solid figure according to an exemplary embodiment of the present invention.
  • FIG. 2B is a schematic diagram showing the drawing of a cylinder according to an exemplary embodiment of the present invention.
  • FIG. 2C is a schematic diagram showing the drawing of a cone according to an exemplary embodiment of the present invention.
  • FIG. 3A is a flowchart of a sample data group determining method according to an exemplary embodiment of the present invention.
  • FIG. 3B is a schematic diagram of a specified contour point determination according to an exemplary embodiment of the present invention.
  • FIG. 3C is a schematic diagram of a cylindrical figure comparison according to an exemplary embodiment of the present invention.
  • FIG. 4 is a flow chart of another method for drawing a solid figure according to an exemplary embodiment of the present invention.
  • FIG. 5 is a hardware structural diagram of a computer device in which a stereoscopic graphics rendering device is shown according to an exemplary embodiment of the present invention.
  • FIG. 6 is a block diagram of a stereoscopic graphics rendering apparatus according to an exemplary embodiment of the present invention.
  • first, second, third, etc. may be used to describe various information in the present invention, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information without departing from the scope of the invention.
  • second information may also be referred to as the first information.
  • word "if” as used herein may be interpreted as "when” or "when” or "in response to determination.”
  • a three-dimensional plan is often used to display a three-dimensional body on a two-dimensional plane in a pseudo 3D manner, and the image on a two-dimensional plane can be referred to as a three-dimensional figure.
  • a two-point method is often used to draw a three-dimensional figure.
  • the P1 point and the P2 point are determined on the screen according to a user operation instruction, and two coordinate points are used as a pair of diagonal vertices, and based on a preset rule, The other two vertex coordinates P3 and P4 are determined, and a rectangle P1P4P2P3 for defining the size of the cylinder to be drawn is obtained.
  • a cylinder pattern is reversed according to the determined rectangle, and a contour point in the upper and lower bottom surfaces of the cylinder pattern and the bus bar are on the side of the rectangle P1P4P2P3, thereby realizing the drawing of the cylinder pattern.
  • P1 and P2 points the user can see the cylindrical figure obtained by drawing, and the user can not draw the desired cylindrical figure by controlling two points very well, and other three-dimensional figures are similar, so two points are adopted.
  • the three-dimensional graphics drawn by the method have a gap with the stereoscopic graphics that the user expects to draw, resulting in low accuracy of the drawn stereoscopic graphics. When the gap is large, the user needs to delete and then re-draw, resulting in low drawing efficiency.
  • the present invention provides a three-dimensional graphic drawing method, which can draw a bottom surface contour of the three-dimensional graphic through two points, and draw other contour contours of the three-dimensional graphic through the third point, thereby
  • the user can control the size of the bottom surface of the solid figure through two points, and control the other surface contours of the three-dimensional figure through the third point, so that the drawing instruction can be actively responded to draw the three-dimensional figure that the user desires to draw, and then Improve the accuracy of drawing stereo graphics.
  • FIG. 2A is a flowchart of a method for drawing a solid figure according to an exemplary embodiment of the present invention, which may include the following steps 201 to 204:
  • step 201 a first point coordinate, a second point coordinate, and a third point coordinate are acquired.
  • the first point coordinate and the second point coordinate are respectively used as the center point coordinate and the contour point coordinate of the bottom surface contour in the stereoscopic graphic to be drawn, and combined with the specified contour on the bottom surface contour of the preset standard solid graphic.
  • the relationship between the point and the center point determines a first scaling ratio of the bottom surface contour of the solid figure to be drawn relative to the bottom surface contour of the standard solid figure.
  • step 203 a bottom surface contour of the stereoscopic graphic to be drawn is drawn based on the first scaling ratio.
  • step 204 the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • the embodiment of the present invention can be applied to a smart device, and the smart device can be a smart tablet, a smart phone, a smart learning machine, a tablet computer, a PDA (Personal Digital Assistant), or a PC (Personal Computer).
  • Functional electronic device The user can use a finger or a stylus to draw a graphic on the touch screen of the smart device, or use a mouse to control the cursor on the screen of the smart device to perform graphic drawing, and the smart device can generate a drawing instruction according to the user operation, and determine three according to the drawing instruction. Point coordinates, and then three-dimensional graphics.
  • the user can also operate an associated device that is bound to the smart device, and the associated device transmits a drawing instruction to the smart device, draws a stereoscopic graphic or the like through the smart device.
  • the three-dimensional figure can be understood as a figure formed by projecting a three-dimensional body onto a two-dimensional plane according to a specified projection condition, and can also be understood as a figure drawn by displaying a three-dimensional body at a preset angle of view on a two-dimensional plane.
  • the stereoscopic graphics obtained by projecting three-dimensional bodies with different projection conditions or different viewing angles may be different.
  • the projection conditions include the placement angle of the three-dimensional body, the distance between the three-dimensional body and the projection device, the projection direction, and the projection method.
  • the projection device can be a device such as a camera.
  • Projection methods include orthogonal projection.
  • the projection direction includes projection toward the XOY plane, projection toward the XOZ plane, projection onto the YOZ plane, and the like, and is not limited herein.
  • the specified projection condition corresponds to the preset angle of view, and the graphic formed by projecting onto the two-dimensional plane according to the specified projection condition may be represented as a graphic drawn on the two-dimensional plane to display the three-dimensional body at a specified angle of view.
  • the visible contour line and the invisible contour line can be displayed separately according to the visibility of each contour line in the three-dimensional figure.
  • the distinguishing display may be: distinguishing between the visible contour line and the invisible contour line by using a solid line and a broken line respectively; or respectively, respectively, distinguishing the visible contour line from the invisible contour line by using different transparency; or, respectively, using different gray scales
  • the visible outline is displayed separately from the invisible outline, wherein the gray scales may be different gray levels of the same color or different gray levels of different colors; or, the visible lines and the invisible outlines are respectively used with different colors. Distinguish the display; or, separate the visible outline from the invisible outline by the different thicknesses of the lines.
  • the visible contour line and the invisible contour line are displayed separately according to the visibility of each contour line in the solid figure. It can make the drawn three-dimensional graphics more realistic and give users a visual enjoyment.
  • the standard stereoscopic graphic is a graphic showing a standard three-dimensional body on a two-dimensional plane with a preset viewing angle, and the standard three-dimensional graphics corresponding to different standard viewing angles may be different when displaying the standard three-dimensional body.
  • the standard three-dimensional body may be a cylinder or a cone, or may be a cylinder with two bottom surfaces parallel and two bottom surfaces being the same regular polygon.
  • the side profile is a contour bus
  • the solid figure to be drawn is the cylinder figure to be drawn.
  • the side contour is the contour bus
  • the solid figure to be drawn is the cone image to be drawn.
  • the standard three-dimensional body is a cylinder whose two bottom faces are parallel and the two bottom faces are the same regular polygon, for example, a cube, two bottom faces are parallel, and the two bottom faces are the same regular hexagonal column
  • the side profile is a side ridge line
  • the solid figure is to be drawn. That is, the cylinder pattern to be drawn.
  • the three point coordinates can be determined by clicking the click position corresponding to the instruction.
  • the click command may be a smart device or an associated device bound to the smart device: a mouse click command, a finger click command, or a touch pen click command. If the click instruction is on the associated device, the associated device can send a drawing instruction carrying three point coordinates to the smart device or the like.
  • the user can click on three discontinuous points respectively, and the device determines three discontinuous points as the first point, the second point, and the third point according to the order of clicking. For example, according to the first click instruction, the first point coordinate is obtained, and according to the second click instruction, the second point coordinate is obtained, and according to the third click instruction, the third point coordinate is obtained.
  • the embodiment of the present invention provides another implementation manner. , you can dynamically adjust the coordinates of the second point, In order to dynamically adjust the size of the bottom surface contour in the solid figure, when the second point confirmation command is received, the coordinate at this time is taken as the final second point coordinate to realize the final confirmation of the bottom surface contour.
  • the third point coordinates can be dynamically adjusted to dynamically adjust other contours in the solid graphics.
  • the coordinates at this time are used as the final third point coordinates to implement the stereoscopic graphics. Final confirmation of other face contours.
  • a stereoscopic graphic can be drawn by dragging (tracting, sliding, moving).
  • the point that the user first triggers is taken as the first point, thereby obtaining the first point coordinate.
  • the first point is used as a starting point for sliding, and any point in the sliding track can be used as the second point.
  • the bottom contour is drawn.
  • the contour of the bottom surface also changes.
  • the contour of the bottom surface desired by the user can be drawn.
  • the coordinates at this time are taken as the final second point coordinates to achieve final confirmation of the bottom contour.
  • the second confirmation command may be a mouse click command, a finger/touch pen click command, or a press command.
  • the second point can be used as a starting point for sliding, and any point in the sliding track can be used as the third point.
  • other planes are drawn.
  • the other surfaces As the coordinates of the third point change, the other surfaces also change.
  • the desired height By adjusting the coordinates of the third point, the desired height can be drawn to obtain the desired three-dimensional. Graphics.
  • the third point it is also possible to slide without using the second point as a starting point, and to re-select a point as a starting point by lifting the pen/lifting/releasing the mouse, etc., in the sliding track Any point can be used as the third point. For example, select the bottom contour center point (P1 point) as the starting point to slide.
  • P1 point bottom contour center point
  • FIG. 2B is a schematic diagram showing the drawing of a cylinder according to an exemplary embodiment of the present invention.
  • the bottom contour will be redrawn, and the other contours will be redrawn each time the coordinates of the third point are changed.
  • FIG. 2B only exemplifies six states in the drawing process.
  • the first point clicked by the user is taken as the first point (P1 point), and the P1 point is used as the starting point for dragging.
  • Any point in the dragging track is the second point, and the dynamics are dynamic for each second point.
  • the corresponding bottom surface contour is drawn, and FIG. 2B is exemplified by taking the P2' point in the drag track as an example, and the bottom surface contour shown in the second state in FIG. 2B is obtained according to P1 and P2' drawing.
  • the point is determined as the final second point, and the final bottom contour is drawn to be drawn, as shown by state three in FIG.
  • FIG. 2B is dragging the track in the P3.
  • the point is exemplified as an example, and a cylinder pattern as shown in state four in Fig. 2B is obtained according to the bottom surface contour and the P3' point drawing shown in the state three.
  • a cylinder pattern as shown in state five in Fig. 2B is obtained according to the bottom surface contour and the P3 point drawing shown in the state three. If a confirmation command is received at point P3, the point is determined to be the final third point and the final cylinder pattern is drawn, as shown in state six of Figure 2B.
  • FIG. 2C is a schematic diagram showing the drawing of a cone according to an exemplary embodiment of the present invention.
  • the bottom contour will be redrawn, and the other contours will be redrawn each time the coordinates of the third point are changed.
  • the height of the cone pattern can be determined, and the distance to be drawn according to the extending direction of the side contour in the standard cone pattern can be determined according to the distance between the second point and the third point.
  • the dynamic effect of other contours in the middle is a schematic diagram showing the drawing of a cone according to an exemplary embodiment of the present invention.
  • steps 202 to 204 are introduced.
  • the relationship between the specified contour point and the center point on the bottom surface contour of the preset standard solid figure is determined by the first point coordinate and the second point coordinate, and the bottom surface contour of the solid figure to be drawn is determined relative to the standard three-dimensional figure.
  • the first scaling of the bottom surface contour is used to draw the bottom surface contour of the solid graphics to be drawn by using the first scaling ratio, and according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure, Draw the outline of the other faces in the perspective.
  • the sample length of each specified contour point on the bottom contour of the standard solid figure to the center point, and the sample reference relationship of the line segment formed by the specified contour point and the center point with respect to the preset reference object may be obtained in advance.
  • a corresponding parameter set can be provided for each specified contour point.
  • the specified contour point is a contour point on the bottom contour of the standard solid figure, and the number of designated contour points can be set according to requirements.
  • the number of specified contour points determines the spacing of the specified contour points, which determines the density of the specified contour points.
  • the larger the number of specified contour points the more the specified contour points corresponding to the second point coordinates and the reference to the second point coordinates are inferred. The more similar the relationship is. Therefore, in consideration of factors such as the processing performance of the smart device, the number of designated contour points is as large as possible, so that a sample reference relationship that is more similar to the reference relationship can be found, thereby drawing a more accurate solid figure.
  • the center point is the center point of the bottom surface contour in the standard solid figure.
  • the center point is the center of the bottom face ellipse.
  • Standard The projection point of the center of the cylinder or the center of the standard cone at the projection plane corresponding to the preset angle of view.
  • the center point is a projection point of the center of the regular polygon at a projection plane corresponding to the preset angle of view.
  • the bottom surface contour of the solid image to be drawn is determined relative to the standard three-dimensional The first scale of the underside outline of the graphic.
  • the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure includes: a correspondence between a sample length and a sample angle, and the sample length is a specified contour point in the standard solid figure.
  • the length of the line segment formed by the center point which is the angle between the line segment and the reference line.
  • the first two-dimensional coordinate system used by the stereoscopic graphics to be drawn satisfies the specified relationship with the second two-dimensional coordinate system used by the standard solid graphics.
  • the specified relationship may be that the X axis of the first two-dimensional coordinate system coincides or is parallel with the X axis of the second two-dimensional coordinate system, and the Y axis of the first two-dimensional coordinate system coincides with the Y axis of the second two-dimensional coordinate system or parallel.
  • the preset reference may be a reference line, for example, the reference line may be one of the two-dimensional coordinate systems.
  • the reference relationship may be the angle between the line segment formed by the specified contour point and the center point in the standard solid figure and the reference line.
  • the target length of the target line segment formed by the first point coordinate and the second point coordinate, and the target clip of the target line segment and the reference line may be calculated.
  • An angle of the sample that is the smallest angle from the target is selected from the angle between the samples; and the target length is compared with the length of the sample corresponding to the angle of the selected sample to obtain a solid to be drawn.
  • the target length can be matched with the angle of the selected sample.
  • the sample length is compared to thereby obtain a first scaling of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid image.
  • the angle between the sample and the angle of the sample within the preset angle can be selected from the angle of the sample.
  • the relationship between the first three-dimensional figure and the first point coordinate and the second point coordinate is established by the angle, and then the first surface contour of the solid image to be drawn is determined relative to the bottom surface contour of the standard three-dimensional figure.
  • the scaling ratio can increase the efficiency of the ratio confirmation.
  • the coordinates can be used to draw the bottom contour of the solid image to be drawn according to the bottom contour of the standard solid figure and the first zoom ratio.
  • the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further includes: drawing information required to draw the bottom surface contour in the standard solid figure.
  • the length in the drawing information may be scaled based on the first scaling ratio; using the length obtained by scaling and the direction in the drawing information, drawing the bottom surface contour of the stereoscopic graphic to be drawn .
  • the drawing information includes a length and an extending direction of the longest radius of the bottom surface contour in the standard solid figure, and a length and an extending direction of the shortest radius, based on The first scaling scales the length of the shortest radius and the length of the longest radius in the drawing information to obtain the shortest radius length and the longest radius length after scaling; the shortest radius length after scaling and the shortest drawing information
  • the extending direction of the radius, and the length of the longest radius after scaling and the extending direction of the longest radius in the drawing information are used to draw the bottom surface contour of the solid graphic to be drawn.
  • the shortest radius may be the distance from the center point of the bottom contour of the standard solid figure to the nearest contour point, and the extension direction of the shortest radius may be the direction from one end to the other end of the shortest radius.
  • the longest radius may be the distance from the center point of the bottom contour of the standard solid figure to the farthest contour point, and the extension direction of the longest radius may be the direction from one end to the other end of the longest radius.
  • the drawing information includes the length and direction of the center point to the vertices of the bottom surface contour in the standard three-dimensional figure.
  • the apex of the bottom surface contour may be the intersection of adjacent edges in the bottom surface contour.
  • the length in the drawing information is scaled based on the first scaling ratio; the bottom surface contour of the stereoscopic graphic to be drawn is drawn using the length obtained by scaling and the direction in the drawing information.
  • the extending direction of the side contours in the standard solid graphics may be obtained in advance.
  • the direction in which the side profile extends may be the direction from either end of the side profile to the other end. Due to projection In the case where the condition (predetermined viewing angle) is determined, the extending direction of the side contour in the standard solid figure is fixed, and therefore, regardless of whether the direction of the second point to the third point coincides with the extending direction, when drawing the side contour in the solid figure, Draw according to the extension direction of the side profile in the standard solid figure.
  • the side contour length of the stereoscopic image to be drawn may be determined, based on the drawn bottom surface contour and the determined side contour length and extending direction, Draw the outline of the other faces in the perspective to be drawn.
  • At least one type of projection condition (predetermined viewing angle) of the sample data group may be pre-stored, and the sample data group includes the specified contour point and the center point on the bottom surface contour of the standard three-dimensional graphic of the same projection condition (predetermined viewing angle). Relationship, and the direction in which the side contours extend in a standard solid figure.
  • the projection matrix corresponding to different projection conditions may be different.
  • the projection matrix is a matrix for converting three-dimensional coordinates into two-dimensional coordinates.
  • a sample data group of a projection condition (preset angle of view) is fixedly stored, and each time the graphics are drawn, the parameters in the sample data group are used for drawing.
  • a sample data set corresponding to a plurality of projection conditions may be stored. Determine the sample data set before drawing the solid figure. For example, based on the projection condition (preset angle of view) setting interface, receiving a projection condition (preset angle of view) setting instruction, determining a projection condition (predetermined angle of view) according to the projection condition (preset angle of view) setting instruction, and further determining a corresponding sample The data set is then subjected to stereoscopic graphics based on the determined sample data set.
  • the projection conditions (preset viewing angle) can be directly described by text, or the standard stereoscopic graphics corresponding to each projection condition (predetermined viewing angle) can be prompted to facilitate the user to view each projection condition (preset viewing angle). The effect of the display, so that the projection condition (preset angle) setting is quickly performed.
  • FIG. 3A is a flowchart of a sample data group determining method according to an exemplary embodiment of the present invention, where the method includes steps 301 to 304:
  • step 301 the bottom surface contour of the standard three-dimensional body is equally divided to obtain at least two halving points.
  • the bottom surface contour of the standard three-dimensional body can be N-divided to obtain N equal points.
  • the number of equal divisions determines the setting density of the equal points. When considering the processing performance of the equipment, the number of equal divisions can be as large as possible.
  • step 302 based on the projection matrix corresponding to the preset viewing angle, determining that the halving point corresponds to the preset viewing angle a projection point of the projection plane, and a projection point of the projection plane corresponding to the center of the standard three-dimensional body, the projection point corresponding to the sub-point is determined as the specified contour point, and the projection point corresponding to the center is determined as The center point.
  • the three-dimensional coordinates of the standard three-dimensional body in the three-dimensional drawing engine can be converted into two by using a projection matrix corresponding to a specified projection condition (predetermined viewing angle).
  • the dimensional coordinates and then based on the two-dimensional coordinates obtained by the transformation, draw a standard solid figure in a two-dimensional plane.
  • the center point is a projection point of the center of the cylinder or the center of the cone at a projection plane corresponding to the preset angle of view.
  • the center point is a projection point of the center of the cylinder bottom surface at a projection plane corresponding to the preset viewing angle.
  • the center of the bottom surface of the cylinder may be a point equal to the distance between the vertices of the bottom surface, that is, the distance from the center of the bottom surface to the apex of the bottom surface is equal. Since the bottom surface is a regular polygon, the center of the bottom surface is the geometric center of the regular polygon.
  • the projection point corresponding to the quinting point may be determined as the specified contour point, and the projection point corresponding to the center may be determined as the center point.
  • step 303 based on the determined specified contour point and the center point, determining a sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and an angle between the line segment and the sample line of the reference line, And drawing information required to draw a bottom contour in the standard solid figure.
  • the drawing information may include a length and an extending direction of the longest radius of the bottom surface contour in the standard three-dimensional figure, and a length and an extending direction of the shortest radius. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information may include the length and direction of the center point to the vertices of the bottom surface contour in the standard solid figure.
  • step 304 an extension direction of the side profile in the standard solid figure is determined based on the determined specified contour point.
  • the coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and the specified contour in the lower bottom contour are The coordinates of the point determine the direction in which the side profile extends in the standard solid figure.
  • the extending direction of the contour bus bar in the standard solid figure is determined based on the coordinates of the specified contour point in the bottom surface contour in the standard solid figure and the vertex coordinates of the standard solid figure.
  • the standard three-dimensional body is a three-dimensional body set as a reference in advance.
  • the projection point of the projection plane corresponding to the preset angle of view may be determined based on the projection matrix corresponding to the preset angle of view (for distinguishing, it may be referred to as a specified contour point), and specifically, determining the contour point coordinates is in advance Set the projection point coordinates of the projection screen corresponding to the angle of view (specify the contour point coordinates).
  • the projection point of the projection plane corresponding to the preset perspective can be determined based on the projection matrix corresponding to the preset perspective (which may be referred to as a center point for differentiation).
  • the projection point coordinate of the standard three-dimensional body projection to the projection plane may be determined based on the projection matrix corresponding to the preset viewing angle, and the projection point coordinate is a coordinate required for drawing the standard solid figure, and then the standard solid figure is drawn according to the determined coordinate. .
  • FIG. 3B is a schematic diagram of a specified contour point determination according to an exemplary embodiment of the present invention.
  • the schematic diagram takes a cylinder as an example, and divides the bottom surface contour of the standard cylinder into N parts (for convenience of explanation, only part of the specified contour point of the bottom surface contour of the cylinder is listed in FIG. 3B), and the aliquot is in advance.
  • the specified contour point is highlighted by using the dot.
  • S i is one of the equal points in the upper and lower contours of the cylinder figure
  • S i ' is one of the equal points in the lower bottom contour of the cylinder figure
  • O is the center point of the upper bottom contour in the cylinder figure.
  • the sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and the sample angle of the line segment and the reference line may be determined according to the coordinates of the specified contour point and the coordinates of the center point.
  • the parameter specifying the contour point S i includes the length of the line segment OS i
  • the angle ⁇ i and the line segment OS i X axis can be used ⁇ ⁇ i ⁇ represents the parameter, 0 ⁇ i ⁇ N.
  • the angle of the sample can also be called the projection angle. According to the vector product formula, we can know:
  • the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further includes: drawing information required for drawing the bottom surface contour in the standard three-dimensional figure. If the standard three-dimensional body is a cylinder or a cone, draw information It may include the longest radius of the bottom surface profile in the standard solid figure and the length and extension direction of the shortest radius. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information may include the length and direction of the center point of the bottom surface contour in the standard solid figure to each vertex.
  • the shortest radius Min(Ri) and the longest radius Max(Ri) can also be determined according to the relationship between the coordinates of the specified contour point and the coordinates of the center point. As shown in Figure 3C.
  • the second two-dimensional coordinate system used by the standard solid figure and the standard three-dimensional figure satisfy that the longest radius coincides with one of the second two-dimensional coordinate systems, and the shortest radius and the second two-dimensional coordinate system
  • the other coordinate axes coincide, and the center point of the bottom contour coincides with the origin of the second two-dimensional coordinate system, which can greatly reduce the calculation amount and save the calculation time.
  • the longest radius and the shortest radius coincide with the coordinate axes respectively, the shortest radius may be referred to as a short axis radius, and the longest radius may also be referred to as a long axis radius.
  • the standard three-dimensional body is a cylinder or a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon
  • the coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and the coordinates of the specified contour point in the lower bottom surface contour may be used. Determine the direction in which the side profile extends in the standard solid figure.
  • the upper bottom surface contour of the standard solid figure is parallel to the lower bottom surface contour, a line segment formed by a specified contour point and a lower contour contour in the upper bottom contour, and other specified contour points and lower bottom contours in the upper bottom contour
  • the line segments formed by the corresponding contour points are parallel, so any line segment extends in the same direction as the side profile in the standard solid figure.
  • the direction of extension of the side profile in the standard solid figure can be determined from the coordinates of S i and S i '. As shown in FIG. 3B, the extending direction is the positive or negative direction of the Y-axis.
  • the extending direction of the contour bus bar of the standard three-dimensional figure can be determined based on the coordinates of the projection point in the bottom surface contour of the standard solid figure and the vertex coordinates of the standard solid figure.
  • FIG. 3C is a schematic diagram of a cylindrical figure comparison according to an exemplary embodiment of the present invention.
  • the first two-dimensional coordinate system used to draw the cylinder pattern satisfies the specified relationship with the second two-dimensional coordinate system used by the standard cylinder pattern.
  • the P1 point coordinates and the P2 point coordinates are obtained, and the P1 point coordinates and the P2 point coordinates are respectively taken as the center point coordinates and the contour point coordinates of the bottom surface contour in the solid figure to be drawn, and the P1 point coordinates correspond to the standard.
  • the O point in the cylinder figure in order to find the specified contour point corresponding to the P2 point in the standard cylinder figure, the angle ⁇ P2P1X of the line segment P2P1 and OX can be calculated, and the minimum gap from the ⁇ P2P1X is selected from the sample angle. The angle of the sample.
  • the first scaling ratio k1 can be determined according to the following formula:
  • the shortest radius and the longest radius in the drawing information are scaled based on the first scaling, obtaining the target short radius k1*Min(R i ), and the target long radius k1*Max(R i ); and using the target short radius K1*Min(R i ) and the target long radius k1*Max(R i ) are used to draw the bottom surface contour of the cylinder figure to be drawn, and the other surface contours are drawn by combining the P3 point coordinates and the extending direction of the side contours in the standard cylinder figure.
  • a non-rotatable solid figure is often drawn by a two-dimensional drawing engine, for example, by a two-point method; a three-dimensional drawing engine can also be used to draw a stereoscopic graphic that can be rotated, for example, a user manually inputs a three-dimensional parameter of a three-dimensional figure, and three-dimensional drawing.
  • the engine can draw the corresponding solid graphics. It can be understood that the two-dimensional drawing engine and the three-dimensional drawing engine draw a picture as a two-dimensional plan.
  • the 2D drawing engine draws a solid figure with fixed projection conditions (preset angle of view) and therefore cannot be rotated.
  • the 3D drawing engine can draw stereoscopic graphics with different display angles according to the rotation operation instructions.
  • the two-dimensional drawing engine and the three-dimensional drawing engine are used independently, and it is impossible to realize the three-dimensional drawing engine to display the three-dimensional graphics and display the three-dimensional graphics in different display viewing angles. Users can only draw with the 2D drawing engine and 3D drawing engine respectively, which has low drawing efficiency and poor user experience.
  • an embodiment of the present invention further provides a method for determining a three-dimensional parameter, the method:
  • S1 determining, according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure, determining a second zoom of the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure proportion.
  • the projection distance of the second point coordinate and the third point coordinate in the extending direction may be determined, and the projection distance may be compared with the length of the side contour in the standard solid figure, and the side contour of the solid figure to be drawn may be obtained relative to the standard solid figure.
  • the second scale of the side profile may be determined, and the projection distance may be compared with the length of the side contour in the standard solid figure, and the side contour of the solid figure to be drawn may be obtained relative to the standard solid figure.
  • the three-dimensional parameters required to draw the standard solid figure by using the three-dimensional drawing engine include the radius of the cylinder or the radius of the bottom surface of the cone and the height of the cylinder or the cone. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the standard three-dimensional graphics are drawn by using a three-dimensional drawing engine.
  • the three-dimensional parameters required when the cylinder is included may be the length of the ridge. For example, when the cylinder is a cylinder with a square bottom surface, the three-dimensional parameter may be the length of the bottom side and the height.
  • the bottom surface three-dimensional parameter of the three-dimensional body can be scaled by using the first scaling ratio, and the height of the three-dimensional body is scaled by the second scaling ratio.
  • the radius of the bottom surface of the standard cylinder is R0 and the height is H0.
  • the three-dimensional drawing engine may draw the stereoscopic graphics to be drawn according to the three-dimensional parameters obtained by the scaling; receive a rotation operation instruction for the stereoscopic graphics to be drawn; and transform the corresponding corresponding to the stereoscopic graphics to be drawn according to the rotation operation instruction.
  • a viewing angle of the three-dimensional body drawing a three-dimensional figure of the three-dimensional body at the viewing angle of the display.
  • the embodiment of the present invention draws the stereoscopic graphics under the changed viewing angle in real time, and the display of the stereoscopic graphics is more intuitive and the user experience is better.
  • FIG. 4 is a flowchart of another method for drawing a solid figure according to an exemplary embodiment of the present invention, the method includes the following steps:
  • step 401 a first point coordinate and a second point coordinate are acquired.
  • step 402 a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a target angle of the target line segment and the preset reference line are calculated.
  • step 403 from the preset correspondence, the angle between the samples having the smallest angle with the target is selected.
  • the correspondence between the sample length and the sample angle is pre-configured, and the sample length is the length of the line segment formed by the specified contour point and the center point on the bottom surface contour in the standard solid figure, and the sample angle is the line segment and the The angle between the reference lines.
  • step 404 the target length is compared with the sample length corresponding to the angle of the selected sample, and is obtained.
  • a first scaling ratio of the bottom surface contour of the solid figure relative to the bottom surface contour of the standard solid figure is drawn.
  • step 405 the bottom surface contour of the stereoscopic graphic to be drawn is drawn according to the first point coordinate, the second point coordinate, and the first scaling.
  • step 406 the third point coordinates are acquired.
  • step 407 may be performed, or step 408 may be performed. There is no sequence of execution between step 407 and step 408. Step 407 may be performed first, and then step 408 may be performed. Step 408 may be performed first, and then step 407 is performed, and no limitation is imposed here.
  • step 406 can be to perform step 407 and perform the triggering condition of step 408. In another example, step 407 can be to perform the trigger condition of step 408, and the like.
  • step 407 the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • step 408 determining the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure.
  • the second scaling is a measure of the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure.
  • step 409 three-dimensional parameters required to draw the standard solid figure using the three-dimensional drawing engine are obtained.
  • step 407 may be used as the trigger condition of step 409, that is, after drawing the contours of other faces in the stereogram to be drawn, step 409 is performed; in another example, step 408 may be used as the trigger condition of step 409. That is, after the second scaling is determined, step 409 and the like are performed, and other conditions may be used as the triggering conditions for performing step 409, which are not enumerated here.
  • step 410 the three-dimensional parameter is scaled based on the first scaling ratio and the second scaling ratio.
  • the step 404 is to obtain the first zoom ratio
  • the step 408 is to obtain the second zoom ratio
  • step 410 can be performed.
  • step 411 the three-dimensional parameters obtained by the scaling are input to the three-dimensional drawing engine.
  • the steps 401 to 411 are the same as the related technologies of the foregoing steps 201 to 204 and 301 to 304, and are not further described herein.
  • the present embodiment draws a bottom surface contour of the three-dimensional figure by two points, and draws other surface contours of the three-dimensional figure through the third point, thereby realizing the drawing of the three-dimensional figure, since the user can control the three-dimensional figure through two points.
  • the three-dimensional size of the corresponding three-dimensional body can be obtained, and the three-dimensional size is transmitted to the three-dimensional drawing engine, and the three-dimensional drawing is used to draw the three-dimensional body in various angles, and the two-dimensional drawing tool and the three-dimensional drawing are realized.
  • the present invention also provides a stereoscopic graphics rendering device, an electronic device to which the device is applied, and an embodiment of a computing storage medium.
  • Embodiments of the stereoscopic graphics rendering apparatus of the present invention can be applied to computer equipment.
  • the device embodiment may be implemented by software, or may be implemented by hardware or a combination of hardware and software.
  • a processor drawn by the stereoscopic graphics is formed by reading a corresponding computer program instruction in the non-volatile memory into the memory.
  • FIG. 5 it is a hardware structure diagram of a computer device where the stereoscopic graphics drawing device of the present invention is located, except for the processor 510, the memory 530, the network interface 520, and the nonvolatile memory shown in FIG. 5.
  • the computer device in which the device 531 is located in the embodiment may further include other hardware according to the actual function of the server, and details are not described herein again.
  • FIG. 6 is a block diagram of a stereoscopic graphics rendering apparatus according to an exemplary embodiment of the present invention.
  • the apparatus includes a coordinate acquiring module 610 , a scaling determining module 620 , and a graphics rendering module 630 .
  • the coordinate acquiring module 610 is configured to acquire first point coordinates, second point coordinates, and third point coordinates.
  • the ratio determining module 620 is configured to respectively use the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the stereoscopic graphic to be drawn, and combined with the bottom surface contour of the preset standard three-dimensional graphic The relationship between the contour point and the center point is specified, and the first scaling ratio of the bottom surface contour of the solid figure to be drawn with respect to the bottom surface contour of the standard solid figure is determined.
  • a graphic drawing module 630 configured to draw a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio; a distance according to the second point coordinate and the third point coordinate, and an extending direction of the side contour in the standard solid graphic , draw the outline of the other faces in the stereogram to be drawn.
  • the standard three-dimensional figure is a graphic that displays a standard three-dimensional body on a two-dimensional plane, and the standard three-dimensional body includes a cylinder, a cone, or two bottom surfaces and two bottom surfaces.
  • a cylinder of the same regular polygon if the standard three-dimensional body is a cylinder or a cone, the side contour is a contour bus; if the standard three-dimensional body is a cylinder with two bottom surfaces parallel and two bottom surfaces being the same regular polygon,
  • the side profile is a side ridgeline.
  • the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure includes: a correspondence between a sample length and a sample angle, and the sample length is a standard solid figure.
  • the length of the line segment formed by the contour point and the center point is specified, and the sample angle is an angle between the line segment and the preset reference line.
  • the apparatus further includes a relationship determining module (not shown in FIG. 6), where the relationship determining module is configured to:
  • the bottom surface contour of the standard three-dimensional body is equally divided to obtain at least two halving points.
  • the projection point corresponding to the point is determined as the specified contour point, and the projection point corresponding to the center is determined as the center point.
  • the ratio determining module 620 includes:
  • the information calculation sub-module is configured to calculate a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a target angle between the target line segment and the reference line.
  • the angle screening sub-module is configured to filter, from the angle of the sample, a sample angle that is the smallest difference from the target angle.
  • the ratio determining sub-module is configured to obtain a first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid graphic by comparing the target length with a sample length corresponding to the selected sample angle.
  • the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further includes: drawing information required to draw the bottom surface contour in the standard three-dimensional graphic;
  • the standard three-dimensional body is a cylinder or a cone, and the drawing information includes a longest radius of the bottom surface contour and a length and an extending direction of the shortest radius in the standard solid figure; if the standard three-dimensional body is two bottom surfaces parallel and two bottom surfaces For a cylinder of the same regular polygon, the rendering information includes the length and direction of the center point to the vertices of the bottom surface contour in the standard solid figure.
  • the graphic drawing module is specifically configured to: scale the length in the drawing information based on the first scaling ratio.
  • the bottom surface contour of the stereoscopic graphic to be drawn is drawn by the length obtained by the scaling and the direction in the drawing information.
  • the apparatus further includes a first direction determining module (not shown in FIG. 6). And for determining an extension direction of the side contour in the standard solid figure based on coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and coordinates of the specified contour point in the lower bottom surface contour.
  • the device further includes a second direction determining module (not shown in FIG. 6) for: based on the bottom surface contour in the standard solid graphic Specify the coordinates of the contour point to And the vertex coordinates of the standard solid figure determine the extending direction of the contour bus bar in the standard solid figure.
  • the apparatus further includes a parameter acquisition module, a parameter scaling module, and a parameter transmission module (not shown in FIG. 6).
  • the ratio determining module is further configured to determine, according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure, the side contour of the solid graphic to be drawn is relative to the standard The second scaling of the side profile of the solid figure.
  • a parameter acquisition module is configured to acquire a three-dimensional parameter required when the standard three-dimensional graphic is drawn by using a three-dimensional drawing engine.
  • a parameter scaling module configured to scale the three-dimensional parameter based on the first scaling ratio and the second scaling ratio.
  • a parameter transmission module for inputting the three-dimensional parameters obtained by the scaling into the three-dimensional drawing engine.
  • the apparatus further includes:
  • a drawing module configured to draw the stereoscopic graphic to be drawn by using the three-dimensional parameters obtained by the scaling based on the three-dimensional drawing engine.
  • an instruction receiving module configured to receive a rotation operation instruction for the stereoscopic graphic to be drawn.
  • the angle of view determining module is configured to transform a display angle of view of the three-dimensional body corresponding to the to-be-drawn three-dimensional figure according to the rotation operation instruction.
  • the drawing module is further configured to draw a three-dimensional figure of the three-dimensional body in the display viewing angle.
  • the present invention also provides an electronic device, the device comprising a processor; a memory for storing processor-executable instructions; wherein the processor is configured to:
  • the relationship determines a first scaling of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics.
  • the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • the electronic device can be a smart tablet, such as a Xiwo interactive smart tablet.
  • an embodiment of the present invention further provides a computer storage medium, where the storage medium stores program instructions, where the program instructions include:
  • the relationship determines a first scaling of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics.
  • the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  • Embodiments of the invention may take the form of a computer program product embodied on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which program code is embodied.
  • Computer-usable storage media include both permanent and non-persistent, removable and non-removable media, and information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM electrically erasable programmable read only memory
  • flash memory or other memory technology
  • compact disk read only memory CD-ROM
  • DVD digital versatile disk
  • Magnetic tape cartridges magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • the device embodiment since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment.
  • the device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components displayed as modules may or may not be physical modules, ie may be located A place, or it can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objectives of the solution of the present invention. Those of ordinary skill in the art can understand and implement without any creative effort.

Landscapes

  • Physics & Mathematics (AREA)
  • Geometry (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

A three-dimensional graphic rendering method, apparatus, and device, and a storage medium, the method comprising: acquiring first point coordinates, second point coordinates, and third point coordinates (201); using the first point coordinates and the second point coordinates as centre point coordinates and contour point coordinates of the bottom contour of the three-dimensional graphic to be rendered, and combining a preset relationship between a specified contour point and centre point of the bottom contour of a standard three-dimensional graphic, determining a first scaling ratio of the bottom contour of the three-dimensional graphic to be rendered relative to the bottom contour of a standard three-dimensional graphic (202); on the basis of the first scaling ratio, rendering the bottom contour of the three-dimensional graphic to be rendered (203); on the basis of the distance between the second coordinates and the third coordinates and the direction of extension of the side contours of the standard three-dimensional graphic, rendering the other contours of the three-dimensional graphic to be rendered (204). The present method can render the three-dimensional graphic desired by the user, improving the accuracy of rendering a three-dimensional graphic.

Description

立体图形绘制方法、装置、设备及存储介质Stereo graphic drawing method, device, device and storage medium 技术领域Technical field
本发明涉及绘图技术领域,尤其涉及立体图形绘制方法、装置、设备及存储介质。The present invention relates to the field of graphics technologies, and in particular, to a stereoscopic graphics rendering method, apparatus, device, and storage medium.
背景技术Background technique
目前,在教学、绘图等场景中,往往会涉及绘制立体图形。立体图形可以理解为将三维体按指定投影条件投影到二维平面上所形成的图形,也可以理解为在二维平面上以特定视角展示三维体而绘制的图形。其中,三维体可以是圆柱体、圆锥体、两个底面为正多边形且底面平行的柱体等。At present, in teaching, drawing and other scenes, it is often involved in drawing stereoscopic graphics. A solid figure can be understood as a figure formed by projecting a three-dimensional body onto a two-dimensional plane according to a specified projection condition, and can also be understood as a figure drawn by displaying a three-dimensional body at a specific angle of view on a two-dimensional plane. The three-dimensional body may be a cylinder, a cone, two cylinders whose bottom surface is a regular polygon and whose bottom surfaces are parallel.
相关技术中,可以在绘图软件中预存立体图形样本,根据用户操作指令从绘图软件的工具栏中拖出立体图形样本进行位置和大小调整,从而获得立体图形。又如,可以采用两点法绘制立体图形,如图1所示,图1是相关技术中利用两点法绘制圆柱体图形的示意图。根据用户操作指令在平面中确定两个点:P1和P2,将两个坐标点作为对角顶点,并基于预设规则,确定其他两个顶点坐标,获得用于限定待绘制圆柱体图形大小的矩形P1P4P2P3。根据所确定的矩形反推一个圆柱体图形,圆柱体图形在矩形P1P4P2P3内,从而实现圆柱体图形的绘制。In the related art, a stereoscopic graphic sample may be pre-stored in the drawing software, and a stereoscopic graphic sample is dragged out from the toolbar of the drawing software according to a user operation instruction to perform position and size adjustment, thereby obtaining a stereoscopic graphic. For another example, a three-point method can be used to draw a three-dimensional figure, as shown in FIG. 1. FIG. 1 is a schematic diagram of drawing a cylindrical figure by a two-point method in the related art. According to the user operation instruction, two points are determined in the plane: P1 and P2, two coordinate points are used as diagonal vertices, and the other two vertex coordinates are determined based on a preset rule, and the size of the cylinder to be drawn is obtained. Rectangular P1P4P2P3. A cylinder figure is reversed according to the determined rectangle, and the cylinder figure is in the rectangle P1P4P2P3, thereby realizing the drawing of the cylinder figure.
可见,上述方法对操作指令的响应效果差,根据操作指令绘制出的立体图形与用户预期绘制出的立体图形具有差距,导致绘制出的立体图形准确度低。It can be seen that the above method has poor response to the operation instruction, and the stereoscopic graphic drawn according to the operation instruction has a gap with the stereoscopic graphic that the user intends to draw, resulting in low accuracy of the drawn stereoscopic graphic.
发明内容Summary of the invention
基于此,本发明提供了立体图形绘制方法、装置、设备及存储介质,以解决对操作指令的响应效果差,导致绘制出的立体图形准确度低的缺陷。Based on this, the present invention provides a method, a device, a device and a storage medium for drawing a solid figure, so as to solve the defect that the response effect on the operation instruction is poor, and the accuracy of the drawn three-dimensional figure is low.
根据本发明实施例的第一方面,提供一种立体图形绘制方法,所述方法包括:According to a first aspect of the embodiments of the present invention, a method for drawing a solid figure is provided, the method comprising:
获取第一点坐标、第二点坐标、第三点坐标;Obtaining a first point coordinate, a second point coordinate, and a third point coordinate;
将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待 绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure Relationship Drawing a first scaling ratio of a bottom surface contour of the solid figure relative to a bottom surface contour of the standard solid figure;
基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio;
根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
在一个可选的实现方式中,所述标准立体图形是在二维平面上以预设视角展示标准三维体的图形,所述标准三维体包括圆柱体、圆锥体、或两底面平行且两底面为相同正多边形的柱体,若所述标准三维体为圆柱体或圆锥体,所述侧面轮廓为轮廓母线;若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述侧面轮廓为侧面棱线。In an optional implementation manner, the standard three-dimensional figure is a graphic that displays a standard three-dimensional body on a two-dimensional plane, and the standard three-dimensional body includes a cylinder, a cone, or two bottom surfaces and two bottom surfaces. a cylinder of the same regular polygon, if the standard three-dimensional body is a cylinder or a cone, the side contour is a contour bus; if the standard three-dimensional body is a cylinder with two bottom surfaces parallel and two bottom surfaces being the same regular polygon, The side profile is a side ridgeline.
在一个可选的实现方式中,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系包括:样本长度和样本夹角的对应关系,所述样本长度是标准立体图形中指定轮廓点与中心点构成的线段的长度,所述样本夹角是所述线段与预设的参照线的夹角。In an optional implementation manner, the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure includes: a correspondence between a sample length and a sample angle, and the sample length is a standard solid figure. The length of the line segment formed by the contour point and the center point is specified, and the sample angle is an angle between the line segment and the preset reference line.
在一个可选的实现方式中,所述样本长度和样本夹角的对应关系的确定步骤包括:In an optional implementation manner, the determining step of the correspondence between the sample length and the sample angle includes:
将所述标准三维体的底面轮廓进行等分,获得至少两个等分点;Dividing the bottom surface contour of the standard three-dimensional body to obtain at least two equal points;
基于预设视角对应的投影矩阵,确定所述等分点在预设视角所对应的投影平面的投影点、以及标准三维体底面中心在预设视角所对应的投影平面的投影点,将该等分点对应的投影点确定为所述指定轮廓点,将中心对应的投影点确定为所述中心点;Determining, according to a projection matrix corresponding to the preset viewing angle, a projection point of the projection plane corresponding to the projection plane corresponding to the preset viewing angle, and a projection point of the projection plane corresponding to the center of the standard three-dimensional body at the preset viewing angle, The projection point corresponding to the point is determined as the specified contour point, and the projection point corresponding to the center is determined as the center point;
基于所确定的指定轮廓点和中心点,确定标准立体图形中所述指定轮廓点与中心点构成的线段的样本长度、以及所述线段与所述参照线的样本夹角。And determining, according to the determined specified contour point and the center point, a sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and an angle between the line segment and the sample line of the reference line.
在一个可选的实现方式中,所述将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例,包括:In an optional implementation manner, the first point coordinate and the second point coordinate are respectively used as a center point coordinate and a contour point coordinate of a bottom surface contour in the solid figure to be drawn, and combined with a preset standard three-dimensional figure. The relationship between each specified contour point and the center point on the bottom surface contour determines the first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid graphic, including:
计算所述第一点坐标和第二点坐标构成的目标线段的目标长度、以及所述目标线段与所述参照线的目标夹角;Calculating a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a target angle between the target line segment and the reference line;
从所述样本夹角中,筛选出与所述目标夹角差距最小的样本夹角;From the angle of the sample, the angle between the samples having the smallest angle with the target is selected;
将所述目标长度与筛选出的样本夹角所对应的样本长度相比,获得待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。Comparing the target length with the sample length corresponding to the selected sample angle, obtaining a first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid image.
在一个可选的实现方式中,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心 点的关系还包括:绘制所述标准立体图形中底面轮廓所需的绘制信息;若所述标准三维体为圆柱体或圆锥体,所述绘制信息包括所述标准立体图形中底面轮廓的最长半径以及最短半径的长度和延伸方向;若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述绘制信息包括所述标准立体图形中底面轮廓的中心点到各顶点的长度和方向;In an optional implementation manner, each of the specified contour points and the center of the preset standard solid figure has a contour point and a center The relationship of points further includes: drawing information required to draw a bottom surface contour in the standard solid figure; if the standard three-dimensional body is a cylinder or a cone, the drawing information includes the longest contour of the bottom surface in the standard solid figure Radius and length and extension direction of the shortest radius; if the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information includes a center point to a vertex of the bottom surface contour in the standard solid figure Length and direction;
所述基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓,包括:The drawing the bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio includes:
基于所述第一缩放比例对所述绘制信息中的长度进行缩放;Scaling the length in the rendering information based on the first scaling ratio;
利用缩放获得的长度以及绘制信息中的方向,绘制所述待绘制立体图形的底面轮廓。The bottom surface contour of the stereoscopic graphic to be drawn is drawn by the length obtained by the scaling and the direction in the drawing information.
在一个可选的实现方式中,若所述标准三维体为圆柱体或两底面平行且两底面为相同正多边形的柱体,所述标准立体图形中侧面轮廓的延伸方向的确定步骤包括:In an optional implementation manner, if the standard three-dimensional body is a cylinder or a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the determining step of the extending direction of the side contour in the standard three-dimensional figure includes:
基于所述标准立体图形的上底面轮廓中指定轮廓点的坐标、以及下底面轮廓中指定轮廓点的坐标,确定标准立体图形中侧面轮廓的延伸方向。The extending direction of the side contour in the standard solid figure is determined based on the coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and the coordinates of the specified contour point in the lower bottom surface contour.
在一个可选的实现方式中,若所述标准三维体为圆锥体,所述标准立体图形中侧面轮廓的延伸方向的确定步骤包括:In an optional implementation manner, if the standard three-dimensional body is a cone, the determining step of extending the side profile in the standard three-dimensional figure includes:
基于所述标准立体图形中底面轮廓中指定轮廓点的坐标、以及所述标准立体图形的顶点坐标,确定标准立体图形中轮廓母线的延伸方向。Determining the extending direction of the contour bus bar in the standard solid figure based on the coordinates of the specified contour point in the bottom surface contour in the standard solid figure and the vertex coordinates of the standard solid figure.
在一个可选的实现方式中,所述方法还包括:In an optional implementation, the method further includes:
根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的长度和延伸方向,确定待绘制立体图形的侧面轮廓相对于标准立体图形的侧面轮廓的第二缩放比例;Determining, according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure, a second scaling ratio of the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure;
获取利用三维绘图引擎绘制所述标准立体图形时所需的三维参数;Obtaining three-dimensional parameters required to draw the standard solid figure using a three-dimensional drawing engine;
基于所述第一缩放比例和所述第二缩放比例,对所述三维参数进行缩放;And scaling the three-dimensional parameter based on the first scaling ratio and the second scaling ratio;
将缩放获得的三维参数输入三维绘图引擎。Enter the 3D parameters obtained by scaling into the 3D drawing engine.
在一个可选的实现方式中,所述方法还包括:In an optional implementation, the method further includes:
基于所述三维绘图引擎,利用缩放获得的三维参数绘制所述待绘制立体图形;And drawing, according to the three-dimensional drawing engine, the three-dimensional parameters obtained by the scaling, the three-dimensional graphics to be drawn;
接收对所述待绘制立体图形的旋转操作指令;Receiving a rotation operation instruction for the stereoscopic graphic to be drawn;
根据所述旋转操作指令变换所述待绘制立体图形所对应的三维体的显示视角;Converting a display angle of view of the three-dimensional body corresponding to the stereoscopic graphic to be drawn according to the rotation operation instruction;
绘制所述三维体在该显示视角下的立体图形。 A three-dimensional figure of the three-dimensional body at the display viewing angle is drawn.
根据本发明实施例的第二方面,提供一种立体图形绘制装置,所述装置包括:According to a second aspect of the embodiments of the present invention, a stereoscopic graphics rendering apparatus is provided, the apparatus comprising:
坐标获取模块,用于获取第一点坐标、第二点坐标、第三点坐标;a coordinate acquiring module, configured to acquire a first point coordinate, a second point coordinate, and a third point coordinate;
比例确定模块,用于将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;a ratio determining module, configured to respectively use the first point coordinate and the second point coordinate as a center point coordinate and a contour point coordinate of a bottom surface contour in the stereoscopic graphic to be drawn, and combined with each of the preset bottom surface contours of the standard three-dimensional graphic a relationship between the contour point and the center point, determining a first scaling ratio of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics;
图形绘制模块,用于基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。a graphic drawing module, configured to draw a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio; a distance according to the second point coordinate and the third point coordinate, and an extending direction of the side contour in the standard solid graphic, Draw the outline of the other faces in the perspective view to be drawn.
根据本发明实施例的第三方面,提供一种电子设备,包括:According to a third aspect of the embodiments of the present invention, an electronic device is provided, including:
处理器;processor;
用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
其中,所述处理器被配置为:Wherein the processor is configured to:
获取第一点坐标、第二点坐标、第三点坐标;Obtaining a first point coordinate, a second point coordinate, and a third point coordinate;
将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio;
根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
在一个可选的实现方式中,所述电子设备为智能平板。In an optional implementation, the electronic device is a smart tablet.
根据本发明实施例的第四方面,提供一种计算机存储介质,所述存储介质中存储有程序指令,所述程序指令包括:According to a fourth aspect of the embodiments of the present invention, a computer storage medium is provided, where the program medium includes program instructions, where the program instructions include:
获取第一点坐标、第二点坐标、第三点坐标;Obtaining a first point coordinate, a second point coordinate, and a third point coordinate;
将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例; Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio;
根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
应用本发明实施例方案,通过两点绘制立体图形的一个底面轮廓,并通过第三点绘制立体图形的其他面轮廓,从而实现立体图形的绘制,由于用户可以通过两点控制立体图形中底面轮廓大小,通过第三个点控制立体图形中其他面轮廓,因此可以积极响应绘图指令,绘制出用户期望绘制的立体图形,进而提高绘制立体图形的准确性。Applying the solution of the embodiment of the present invention, a bottom surface contour of the three-dimensional graphic is drawn by two points, and other surface contours of the three-dimensional graphic are drawn through the third point, thereby realizing the drawing of the three-dimensional graphic, because the user can control the bottom surface contour of the solid graphic through two points. The size controls the other contours in the solid figure through the third point, so the drawing instructions can be actively responded to draw the three-dimensional graphics that the user desires to draw, thereby improving the accuracy of drawing the stereoscopic graphics.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本发明。The above general description and the following detailed description are intended to be illustrative and not restrictive.
附图说明DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in the specification of FIG
图1是相关技术中利用两点法绘制圆柱体图形的示意图。Fig. 1 is a schematic view showing a cylindrical figure drawn by a two-point method in the related art.
图2A是本发明根据一示例性实施例示出的一种立体图形绘制方法的流程图。FIG. 2A is a flowchart of a method for drawing a solid figure according to an exemplary embodiment of the present invention.
图2B是本发明根据一示例性实施例示出的一种圆柱体图形绘制示意图。FIG. 2B is a schematic diagram showing the drawing of a cylinder according to an exemplary embodiment of the present invention.
图2C是本发明根据一示例性实施例示出的一种圆锥体图形绘制示意图。FIG. 2C is a schematic diagram showing the drawing of a cone according to an exemplary embodiment of the present invention.
图3A是本发明根据一示例性实施例示出的一种样本数据组确定方法的流程图。FIG. 3A is a flowchart of a sample data group determining method according to an exemplary embodiment of the present invention.
图3B是本发明根据一示例性实施例示出的一种指定轮廓点确定示意图。FIG. 3B is a schematic diagram of a specified contour point determination according to an exemplary embodiment of the present invention.
图3C是本发明根据一示例性实施例示出的一种圆柱体图形对照示意图。FIG. 3C is a schematic diagram of a cylindrical figure comparison according to an exemplary embodiment of the present invention.
图4是本发明根据一示例性实施例示出的另一种立体图形绘制方法的流程图。FIG. 4 is a flow chart of another method for drawing a solid figure according to an exemplary embodiment of the present invention.
图5是本发明根据一示例性实施例示出的立体图形绘制装置所在计算机设备的一种硬件结构图。FIG. 5 is a hardware structural diagram of a computer device in which a stereoscopic graphics rendering device is shown according to an exemplary embodiment of the present invention.
图6是本发明根据一示例性实施例示出的一种立体图形绘制装置的框图。FIG. 6 is a block diagram of a stereoscopic graphics rendering apparatus according to an exemplary embodiment of the present invention.
具体实施方式 Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. The following description refers to the same or similar elements in the different figures unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with aspects of the invention as detailed in the appended claims.
在本发明使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本发明。在本发明和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in the present invention is for the purpose of describing particular embodiments, and is not intended to limit the invention. The singular forms "a", "the" and "the" It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本发明可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本发明范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used to describe various information in the present invention, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, the first information may also be referred to as the second information without departing from the scope of the invention. Similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determination."
为了适应教学等应用场景的需求,往往采用伪3D的方式在二维平面上利用二维平面图展示三维体,可以将二维平面上的该图称为立体图形。相关技术中往往采用两点法绘制立体图形,如图1所示,根据用户操作指令在屏幕中确定P1点和P2点,将两个坐标点作为一对对角顶点,并基于预设规则,确定其他两个顶点坐标P3点和P4点,获得用于限定待绘制圆柱体图形大小的矩形P1P4P2P3。根据所确定的矩形反推一个圆柱体图形,圆柱体图形中上下底面中的某轮廓点以及母线在矩形P1P4P2P3的边上,从而实现圆柱体图形的绘制。可见,当用户指定P1和P2点后,用户才能看到绘制获得的圆柱体图形,用户不能很好的通过控制两个点绘制出期望的圆柱体图形,其他立体图形同理,因此采用两点法绘制出的立体图形与用户预期绘制出的立体图形具有差距,导致绘制出的立体图形准确度低。当差距较大时,用户需要删除后重新绘制,从而导致绘制效率低。In order to meet the needs of teaching and other application scenarios, a three-dimensional plan is often used to display a three-dimensional body on a two-dimensional plane in a pseudo 3D manner, and the image on a two-dimensional plane can be referred to as a three-dimensional figure. In the related art, a two-point method is often used to draw a three-dimensional figure. As shown in FIG. 1, the P1 point and the P2 point are determined on the screen according to a user operation instruction, and two coordinate points are used as a pair of diagonal vertices, and based on a preset rule, The other two vertex coordinates P3 and P4 are determined, and a rectangle P1P4P2P3 for defining the size of the cylinder to be drawn is obtained. A cylinder pattern is reversed according to the determined rectangle, and a contour point in the upper and lower bottom surfaces of the cylinder pattern and the bus bar are on the side of the rectangle P1P4P2P3, thereby realizing the drawing of the cylinder pattern. It can be seen that when the user specifies the P1 and P2 points, the user can see the cylindrical figure obtained by drawing, and the user can not draw the desired cylindrical figure by controlling two points very well, and other three-dimensional figures are similar, so two points are adopted. The three-dimensional graphics drawn by the method have a gap with the stereoscopic graphics that the user expects to draw, resulting in low accuracy of the drawn stereoscopic graphics. When the gap is large, the user needs to delete and then re-draw, resulting in low drawing efficiency.
基于此,为了避免绘制出的立体图形准确度低的缺陷,本发明提供立体图形绘制方法,可以通过两点绘制立体图形的一个底面轮廓,并通过第三点绘制立体图形的其他面轮廓,从而实现立体图形的绘制,由于用户可以通过两点控制立体图形中底面轮廓大小,通过第三个点控制立体图形中其他面轮廓,因此可以积极响应绘图指令,绘制出用户期望绘制的立体图形,进而提高绘制立体图形的准确性。接下来结合附图对本发明方案进行详细说明。Based on this, in order to avoid the defect that the drawn three-dimensional graphics have low accuracy, the present invention provides a three-dimensional graphic drawing method, which can draw a bottom surface contour of the three-dimensional graphic through two points, and draw other contour contours of the three-dimensional graphic through the third point, thereby To realize the drawing of the three-dimensional figure, the user can control the size of the bottom surface of the solid figure through two points, and control the other surface contours of the three-dimensional figure through the third point, so that the drawing instruction can be actively responded to draw the three-dimensional figure that the user desires to draw, and then Improve the accuracy of drawing stereo graphics. The solution of the present invention will be described in detail below with reference to the accompanying drawings.
如图2A所示,图2A是本发明根据一示例性实施例示出的一种立体图形绘制方法的流程图,可以包括以下步骤201至步骤204: As shown in FIG. 2A, FIG. 2A is a flowchart of a method for drawing a solid figure according to an exemplary embodiment of the present invention, which may include the following steps 201 to 204:
在步骤201中,获取第一点坐标、第二点坐标、第三点坐标。In step 201, a first point coordinate, a second point coordinate, and a third point coordinate are acquired.
在步骤202中,将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。In step 202, the first point coordinate and the second point coordinate are respectively used as the center point coordinate and the contour point coordinate of the bottom surface contour in the stereoscopic graphic to be drawn, and combined with the specified contour on the bottom surface contour of the preset standard solid graphic. The relationship between the point and the center point determines a first scaling ratio of the bottom surface contour of the solid figure to be drawn relative to the bottom surface contour of the standard solid figure.
在步骤203中,基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓。In step 203, a bottom surface contour of the stereoscopic graphic to be drawn is drawn based on the first scaling ratio.
在步骤204中,根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。In step 204, the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
本发明实施例可以应用在智能设备中,智能设备可以是智能平板、智能手机、智能学习机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)或PC(Personal Computer,个人计算机)等具有绘图功能的电子设备。用户可以利用手指或触控笔等在智能设备的触摸屏上进行图形绘制,也可以利用鼠标控制智能设备屏幕上的光标进行图形绘制,智能设备可以根据用户操作产生绘制指令,并根据绘制指令确定三点坐标,进而进行立体图形绘制。此外,用户还可以操作与智能设备绑定的关联设备,该关联设备将绘制指令传送至智能设备,通过智能设备绘制立体图形等。The embodiment of the present invention can be applied to a smart device, and the smart device can be a smart tablet, a smart phone, a smart learning machine, a tablet computer, a PDA (Personal Digital Assistant), or a PC (Personal Computer). Functional electronic device. The user can use a finger or a stylus to draw a graphic on the touch screen of the smart device, or use a mouse to control the cursor on the screen of the smart device to perform graphic drawing, and the smart device can generate a drawing instruction according to the user operation, and determine three according to the drawing instruction. Point coordinates, and then three-dimensional graphics. In addition, the user can also operate an associated device that is bound to the smart device, and the associated device transmits a drawing instruction to the smart device, draws a stereoscopic graphic or the like through the smart device.
其中,立体图形可以理解为将三维体按指定投影条件投影到二维平面上所形成的图形,也可以理解为在二维平面上以预设视角展示三维体而绘制的图形。以不同投影条件投影或不同视角展示三维体获得的立体图形可能不同。投影条件包括三维体的放置角度、三维体与投影设备的距离、投影方向以及投影方式等。投影设备可以是相机等设备。投影方式包括正交投影等方式。投影方向包括朝向XOY面进行投影、朝向XOZ面进行投影以及朝向YOZ面进行投影等,在此不做限制。指定投影条件与预设视角对应,按指定投影条件投影到二维平面上所形成的图形,可以表示为在二维平面上以指定视角展示三维体而绘制的图形。The three-dimensional figure can be understood as a figure formed by projecting a three-dimensional body onto a two-dimensional plane according to a specified projection condition, and can also be understood as a figure drawn by displaying a three-dimensional body at a preset angle of view on a two-dimensional plane. The stereoscopic graphics obtained by projecting three-dimensional bodies with different projection conditions or different viewing angles may be different. The projection conditions include the placement angle of the three-dimensional body, the distance between the three-dimensional body and the projection device, the projection direction, and the projection method. The projection device can be a device such as a camera. Projection methods include orthogonal projection. The projection direction includes projection toward the XOY plane, projection toward the XOZ plane, projection onto the YOZ plane, and the like, and is not limited herein. The specified projection condition corresponds to the preset angle of view, and the graphic formed by projecting onto the two-dimensional plane according to the specified projection condition may be represented as a graphic drawn on the two-dimensional plane to display the three-dimensional body at a specified angle of view.
进一步的,为了在二维平面中体现出更加真实的三维体,可以根据立体图形中每条轮廓线的可见性,将可见轮廓线和不可见轮廓线区分显示。Further, in order to reflect a more realistic three-dimensional body in a two-dimensional plane, the visible contour line and the invisible contour line can be displayed separately according to the visibility of each contour line in the three-dimensional figure.
例如,区分显示可以是:分别用实线和虚线对可见轮廓线和不可见轮廓线区分显示;或,分别用不同透明度对可见轮廓线与不可见轮廓线区分显示;或,分别用不同灰度对可见轮廓线与不可见轮廓线区分显示,其中,上述灰度可以是同一颜色的不同灰度也可以是不同颜色的不同灰度;或,分别用不同颜色对可见轮廓线与不可见轮廓线区分显示;或,分别用线条的不同粗细对可见轮廓线与不可见轮廓线区分显示。For example, the distinguishing display may be: distinguishing between the visible contour line and the invisible contour line by using a solid line and a broken line respectively; or respectively, respectively, distinguishing the visible contour line from the invisible contour line by using different transparency; or, respectively, using different gray scales The visible outline is displayed separately from the invisible outline, wherein the gray scales may be different gray levels of the same color or different gray levels of different colors; or, the visible lines and the invisible outlines are respectively used with different colors. Distinguish the display; or, separate the visible outline from the invisible outline by the different thicknesses of the lines.
可见,根据立体图形中每条轮廓线的可见性,将可见轮廓线和不可见轮廓线区分显示, 可以使绘制出的立体图形更加逼真,给用户带来视觉享受。It can be seen that the visible contour line and the invisible contour line are displayed separately according to the visibility of each contour line in the solid figure. It can make the drawn three-dimensional graphics more realistic and give users a visual enjoyment.
本发明实施例中,所述标准立体图形是在二维平面上以预设视角展示标准三维体的图形,不同视角展示标准三维体时所对应的标准立体图形可能不同。In the embodiment of the present invention, the standard stereoscopic graphic is a graphic showing a standard three-dimensional body on a two-dimensional plane with a preset viewing angle, and the standard three-dimensional graphics corresponding to different standard viewing angles may be different when displaying the standard three-dimensional body.
在一个可选的实现方式中,所述标准三维体可以是圆柱体,也可以是圆锥体,还可以是两底面平行且两底面为相同正多边形的柱体等。In an optional implementation manner, the standard three-dimensional body may be a cylinder or a cone, or may be a cylinder with two bottom surfaces parallel and two bottom surfaces being the same regular polygon.
若标准三维体为圆柱体,则侧面轮廓为轮廓母线,待绘制立体图形即为待绘制圆柱体图形。在绘制待绘制圆柱体图形时,可以根据前面两个点绘制一个底面轮廓,然后根据第三个点绘制轮廓母线和另一个底面轮廓。可见,通过本发明方案可以实现圆柱体图形的绘制。If the standard three-dimensional body is a cylinder, the side profile is a contour bus, and the solid figure to be drawn is the cylinder figure to be drawn. When drawing a cylinder shape to be drawn, you can draw a bottom contour based on the first two points, and then draw the contour bus and the other bottom contour according to the third point. It can be seen that the drawing of the cylinder figure can be realized by the solution of the invention.
若标准三维体为圆锥体,则侧面轮廓为轮廓母线,待绘制立体图形即为待绘制圆锥体图形。在绘制待绘制圆锥体图形时,可以根据前面两个点绘制底面轮廓,然后根据第三个点绘制轮廓母线。可见,通过本发明方案可以实现圆锥体图形的绘制。If the standard three-dimensional body is a cone, the side contour is the contour bus, and the solid figure to be drawn is the cone image to be drawn. When drawing the cone shape to be drawn, you can draw the bottom contour based on the first two points and then draw the contour bus according to the third point. It can be seen that the drawing of the cone pattern can be realized by the solution of the invention.
若标准三维体为两底面平行且两底面为相同正多边形的柱体,例如正方体、两底面平行且两底面为相同正六边形的柱体等,则侧面轮廓为侧面棱线,待绘制立体图形即为待绘制柱体图形。在绘制待绘制柱体图形时,可以根据前面两个点绘制底面多边形轮廓,然后根据第三个点绘制侧面棱线。可见,通过本发明方案可以实现特定柱体图形的绘制。If the standard three-dimensional body is a cylinder whose two bottom faces are parallel and the two bottom faces are the same regular polygon, for example, a cube, two bottom faces are parallel, and the two bottom faces are the same regular hexagonal column, the side profile is a side ridge line, and the solid figure is to be drawn. That is, the cylinder pattern to be drawn. When drawing a cylinder shape to be drawn, you can draw the bottom polygon outline based on the first two points, and then draw the side ridge according to the third point. It can be seen that the drawing of a specific cylinder figure can be achieved by the solution of the invention.
关于坐标点获取与图形绘制的顺序,可以在获取到第一点坐标、第二点坐标以及第三点坐标以后,再进行立体图形所有面的绘制;也可以在获取第一点坐标和第二点坐标后,先进行立体图形中一个底面绘制,然后获取第三点坐标,并进行立体图形其他面的绘制。Regarding the order of coordinate point acquisition and graphic drawing, after acquiring the first point coordinate, the second point coordinate, and the third point coordinate, all the faces of the solid figure can be drawn; or the first point coordinate and the second point can be obtained. After the point coordinates, first draw a bottom surface in the solid figure, then obtain the third point coordinates, and draw the other side of the solid figure.
关于点坐标的确定,在一个例子中,三个点坐标可以通过点击指令所对应的点击位置确定。其中,点击指令可以是智能设备或与智能设备绑定的关联设备上:鼠标点击指令、手指点击指令、或触摸笔点击指令等。若点击指令在关联设备上,关联设备可以将携带三个点坐标的绘制指令发送至智能设备等。用户可以分别点击三个不连续的点,设备根据点击顺序,将三个不连续的点分别确定为第一点、第二点、第三点。例如,根据第一个点击指令,获取第一点坐标,根据第二个点击指令,获取第二点坐标,根据第三个点击指令,获取第三点坐标。Regarding the determination of the point coordinates, in one example, the three point coordinates can be determined by clicking the click position corresponding to the instruction. The click command may be a smart device or an associated device bound to the smart device: a mouse click command, a finger click command, or a touch pen click command. If the click instruction is on the associated device, the associated device can send a drawing instruction carrying three point coordinates to the smart device or the like. The user can click on three discontinuous points respectively, and the device determines three discontinuous points as the first point, the second point, and the third point according to the order of clicking. For example, according to the first click instruction, the first point coordinate is obtained, and according to the second click instruction, the second point coordinate is obtained, and according to the third click instruction, the third point coordinate is obtained.
上述方式虽然可以通过三个点确定立体图形,但在绘制过程中,第一点坐标、第二点坐标以及第三点坐标均是通过点击操作直接确定,而在第一点坐标和第二点坐标确定后,则无法修改立体图形中底面轮廓的大小,在第三点坐标确定后,则无法修改立体图形的其他面轮廓,为了克服这种缺陷,本发明实施例还提供另一种实现方式,可以动态调整第二点坐标, 以实现动态调整立体图形中底面轮廓的大小,在接收到第二点确认指令时,将此时的坐标作为最终的第二点坐标,以实现底面轮廓的最终确认。另外,还可以动态调整第三点坐标,以实现动态调整立体图形中其他面轮廓,在接收到第三点确认指令时,将此时的坐标作为最终的第三点坐标,以实现立体图形中其他面轮廓的最终确认。Although the above method can determine the stereoscopic figure through three points, in the drawing process, the first point coordinate, the second point coordinate, and the third point coordinate are directly determined by the click operation, and the first point coordinate and the second point are After the coordinates are determined, the size of the bottom surface contour in the solid graphics cannot be modified. After the third coordinate is determined, the other surface contours of the solid graphics cannot be modified. To overcome the defect, the embodiment of the present invention provides another implementation manner. , you can dynamically adjust the coordinates of the second point, In order to dynamically adjust the size of the bottom surface contour in the solid figure, when the second point confirmation command is received, the coordinate at this time is taken as the final second point coordinate to realize the final confirmation of the bottom surface contour. In addition, the third point coordinates can be dynamically adjusted to dynamically adjust other contours in the solid graphics. When the third point confirmation command is received, the coordinates at this time are used as the final third point coordinates to implement the stereoscopic graphics. Final confirmation of other face contours.
本实现方式中,可以通过拖拽(牵引、滑动、移动)的方式绘制立体图形。在绘制过程中,将用户首次触发的点作为第一点,从而获得第一点坐标。以第一点为起点进行滑动,该滑动轨迹中的任意点均可作为第二点。根据第一点和当前第二点进行底面轮廓的绘制,随着第二点坐标不断变化,底面轮廓也随之变化,通过调整第二点的坐标,可以绘制出用户期望的底面轮廓。当接收到第二点确认指令时,将此时的坐标作为最终的第二点坐标,以实现底面轮廓的最终确认。第二点确认指令可以是鼠标点击指令、手指/触摸笔点击指令、或者按压指令等。同理,可以以第二点为起点进行滑动,该滑动轨迹中的任意点均可以作为第三点。根据底面轮廓和第三点进行其他面的绘制,随着第三点坐标不断变化,其他面也随之变化,通过调整第三点的坐标,可以绘制出用户期望的高,从而获得期望的立体图形。In this implementation manner, a stereoscopic graphic can be drawn by dragging (tracting, sliding, moving). In the drawing process, the point that the user first triggers is taken as the first point, thereby obtaining the first point coordinate. The first point is used as a starting point for sliding, and any point in the sliding track can be used as the second point. According to the first point and the current second point, the bottom contour is drawn. As the coordinates of the second point change continuously, the contour of the bottom surface also changes. By adjusting the coordinates of the second point, the contour of the bottom surface desired by the user can be drawn. When the second confirmation command is received, the coordinates at this time are taken as the final second point coordinates to achieve final confirmation of the bottom contour. The second confirmation command may be a mouse click command, a finger/touch pen click command, or a press command. Similarly, the second point can be used as a starting point for sliding, and any point in the sliding track can be used as the third point. According to the bottom contour and the third point, other planes are drawn. As the coordinates of the third point change, the other surfaces also change. By adjusting the coordinates of the third point, the desired height can be drawn to obtain the desired three-dimensional. Graphics.
需要指出的是,确定第三点时,也可以不以第二点为起点进行滑动,而通过抬笔/抬手/松开鼠标等方式重新选择一个点为起点进行滑动,该滑动轨迹中的任意点均可以作为第三点。例如,选择底面轮廓中心点(P1点)为起点进行滑动。It should be pointed out that when the third point is determined, it is also possible to slide without using the second point as a starting point, and to re-select a point as a starting point by lifting the pen/lifting/releasing the mouse, etc., in the sliding track Any point can be used as the third point. For example, select the bottom contour center point (P1 point) as the starting point to slide.
为了方便理解,本发明实施例以两个具体实施例进行说明。如图2B所示,图2B是本发明根据一示例性实施例示出的一种圆柱体图形绘制示意图。第一点(P1点)到最终的第二点(P2点),以及最终的第二点到最终的第三点(P3点),展示出来的图呈现动态效果,每更改第二点的坐标均会重新绘制底面轮廓,每更改第三点的坐标均会重新绘制其他面轮廓。在确定底面轮廓后,通过移动第三点,可以呈现出根据第二点和第三点的距离按标准圆柱体图形中侧面轮廓的延伸方向绘制待绘制圆柱体图形中其他面轮廓的动态效果。For ease of understanding, the embodiments of the present invention are described in two specific embodiments. FIG. 2B is a schematic diagram showing the drawing of a cylinder according to an exemplary embodiment of the present invention. The first point (P1 point) to the final second point (P2 point), and the final second point to the final third point (P3 point), the displayed figure shows a dynamic effect, each change the coordinates of the second point The bottom contour will be redrawn, and the other contours will be redrawn each time the coordinates of the third point are changed. After determining the bottom contour, by moving the third point, it is possible to present the dynamic effect of drawing the contours of the other contours in the cylinder to be drawn according to the extending direction of the side contours in the standard cylinder pattern according to the distance between the second point and the third point.
为了示意方便,图2B仅列举绘制过程中六个状态进行示例说明。在绘图过程中,用户点击的第一个点作为第一点(P1点),以P1点为起点进行拖动,拖动轨迹中任何一点均为第二点,针对每个第二点均动态绘制相应的底面轮廓,图2B以拖动轨迹中P2’点为例进行示例说明,根据P1和P2’绘制获得如图2B中状态二所示的底面轮廓。当拖动到P2点时,如果接收到确认指令,则将该点确定为最终的第二点,并绘制获得最终的底面轮廓,如图2B中状态三所示。然后,以P1点为起点进行拖动,拖动轨迹中任何一点均为第三点,针对每个第三点均动态绘制相应的圆柱体图形的其他面轮廓,图2B以拖动轨迹中P3’点为例进行示例说明,根据状态三所示的底面轮廓和P3’点绘制获得如图2B中状态四所示的圆柱体图形。当拖动到 P3点时,根据状态三所示的底面轮廓和P3点绘制获得如图2B中状态五所示的圆柱体图形。如果在P3点接收到确认指令,则将该点确定为最终的第三点,并绘制获得最终的圆柱体图形,如图2B中状态六所示。For convenience of illustration, FIG. 2B only exemplifies six states in the drawing process. During the drawing process, the first point clicked by the user is taken as the first point (P1 point), and the P1 point is used as the starting point for dragging. Any point in the dragging track is the second point, and the dynamics are dynamic for each second point. The corresponding bottom surface contour is drawn, and FIG. 2B is exemplified by taking the P2' point in the drag track as an example, and the bottom surface contour shown in the second state in FIG. 2B is obtained according to P1 and P2' drawing. When dragging to the P2 point, if a confirmation command is received, the point is determined as the final second point, and the final bottom contour is drawn to be drawn, as shown by state three in FIG. 2B. Then, the P1 point is used as the starting point for dragging, and any point in the drag track is the third point, and the other surface contours of the corresponding cylinder figure are dynamically drawn for each third point, and FIG. 2B is dragging the track in the P3. The point is exemplified as an example, and a cylinder pattern as shown in state four in Fig. 2B is obtained according to the bottom surface contour and the P3' point drawing shown in the state three. When dragged to At point P3, a cylinder pattern as shown in state five in Fig. 2B is obtained according to the bottom surface contour and the P3 point drawing shown in the state three. If a confirmation command is received at point P3, the point is determined to be the final third point and the final cylinder pattern is drawn, as shown in state six of Figure 2B.
如图2C所示,图2C是本发明根据一示例性实施例示出的一种圆锥体图形绘制示意图。第一点(P1点)到最终的第二点(P2点),以及最终的第二点到最终的第三点(P3点),展示出来的图呈现动态效果,每更改第二点的坐标均会重新绘制底面轮廓,每更改第三点的坐标均会重新绘制其他面轮廓。在确定底面轮廓后,通过移动第三点,可以确定圆锥体图形的高,并呈现出根据第二点和第三点的距离按标准圆锥体图形中侧面轮廓的延伸方向绘制待绘制圆锥体图形中其他面轮廓的动态效果。As shown in FIG. 2C, FIG. 2C is a schematic diagram showing the drawing of a cone according to an exemplary embodiment of the present invention. The first point (P1 point) to the final second point (P2 point), and the final second point to the final third point (P3 point), the displayed figure shows a dynamic effect, each change the coordinates of the second point The bottom contour will be redrawn, and the other contours will be redrawn each time the coordinates of the third point are changed. After determining the bottom contour, by moving the third point, the height of the cone pattern can be determined, and the distance to be drawn according to the extending direction of the side contour in the standard cone pattern can be determined according to the distance between the second point and the third point. The dynamic effect of other contours in the middle.
接下来对步骤202至步骤204进行介绍。Next, steps 202 to 204 are introduced.
本发明实施例通过第一点坐标和第二点坐标、以及预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例,实现利用第一缩放比例绘制待绘制立体图形的底面轮廓,并根据第二点坐标和第三点坐标的距离、以及标准立体图形中侧面轮廓的延伸方向,绘制待绘制立体图中其他面的轮廓。In the embodiment of the present invention, the relationship between the specified contour point and the center point on the bottom surface contour of the preset standard solid figure is determined by the first point coordinate and the second point coordinate, and the bottom surface contour of the solid figure to be drawn is determined relative to the standard three-dimensional figure. The first scaling of the bottom surface contour is used to draw the bottom surface contour of the solid graphics to be drawn by using the first scaling ratio, and according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure, Draw the outline of the other faces in the perspective.
首先,对预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系、以及标准立体图形中侧面轮廓的延伸方向进行介绍。First, the relationship between each specified contour point on the bottom surface contour of the preset standard solid figure and the center point, and the extension direction of the side contour in the standard three-dimensional figure are introduced.
在将第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标时,为了推测出在标准立体图形中与第二点坐标具有相似参照关系的指定轮廓点,可以预先获取标准立体图形中底面轮廓上各指定轮廓点到中心点的样本长度、以及指定轮廓点与中心点构成的线段相对于预设参照物的样本参照关系。针对每个指定轮廓点可以设有相应的参数组(样本长度,样本参照关系)。When the first point coordinate and the second point coordinate are respectively used as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, in order to infer a specified contour having a similar reference relationship with the second point coordinate in the standard solid figure Point, the sample length of each specified contour point on the bottom contour of the standard solid figure to the center point, and the sample reference relationship of the line segment formed by the specified contour point and the center point with respect to the preset reference object may be obtained in advance. A corresponding parameter set (sample length, sample reference relationship) can be provided for each specified contour point.
其中,指定轮廓点是标准立体图形的底面轮廓上的轮廓点,指定轮廓点的数量可以根据需求设定。指定轮廓点的数量决定了指定轮廓点的间距,进而决定了指定轮廓点的密度,指定轮廓点的数量越大,推测出与第二点坐标对应的指定轮廓点与第二点坐标具有的参照关系越相似。因此,在考虑智能设备处理性能等因素允许的情况下,指定轮廓点的数量尽量大,从而实现可以找到与参照关系更加近似的样本参照关系,进而绘制更加准确的立体图形。Wherein, the specified contour point is a contour point on the bottom contour of the standard solid figure, and the number of designated contour points can be set according to requirements. The number of specified contour points determines the spacing of the specified contour points, which determines the density of the specified contour points. The larger the number of specified contour points, the more the specified contour points corresponding to the second point coordinates and the reference to the second point coordinates are inferred. The more similar the relationship is. Therefore, in consideration of factors such as the processing performance of the smart device, the number of designated contour points is as large as possible, so that a sample reference relationship that is more similar to the reference relationship can be found, thereby drawing a more accurate solid figure.
中心点是标准立体图形中底面轮廓的中心点,例如,标准三维体为圆柱体或圆锥体时,即标准立体图形为标准圆柱体图形或标准圆锥体图形,则中心点为底面椭圆的中心,即标准 圆柱体或标准圆锥体底面圆心在预设视角所对应的投影平面的投影点。标准三维体为两底面平行且两底面为相同正多边形的柱体时,中心点为正多边形的中心在预设视角所对应的投影平面的投影点。The center point is the center point of the bottom surface contour in the standard solid figure. For example, when the standard three-dimensional body is a cylinder or a cone, that is, the standard solid figure is a standard cylinder figure or a standard cone figure, the center point is the center of the bottom face ellipse. Standard The projection point of the center of the cylinder or the center of the standard cone at the projection plane corresponding to the preset angle of view. When the standard three-dimensional body is a cylinder whose two bottom faces are parallel and the two bottom faces are the same regular polygon, the center point is a projection point of the center of the regular polygon at a projection plane corresponding to the preset angle of view.
在获取第一点坐标和第二点坐标后,可以确定第一点坐标与第二点坐标所构成的目标线段的目标长度、以及该目标线段与预设参照物的参照关系;从预设的样本长度以及样本参照关系中,筛选出与所述参照关系近似相同的样本参照关系,并基于所述长度以及筛选出的参照关系对应的样本长度,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。After acquiring the first point coordinate and the second point coordinate, determining a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a reference relationship between the target line segment and the preset reference object; In the sample length and the sample reference relationship, a sample reference relationship that is approximately the same as the reference relationship is selected, and based on the length and the sample length corresponding to the selected reference relationship, the bottom surface contour of the solid image to be drawn is determined relative to the standard three-dimensional The first scale of the underside outline of the graphic.
由上述实施例可见,通过参考同一预设参照物,可以建立标准立体图形与第一点坐标和第二点坐标之间的关系,进而确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。It can be seen from the above embodiment that by referring to the same preset reference object, the relationship between the standard three-dimensional graphics and the first point coordinates and the second point coordinates can be established, thereby determining the bottom surface contour of the solid graphics to be drawn relative to the bottom surface of the standard three-dimensional graphics. The first scale of the outline.
在一个例子中,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系包括:样本长度和样本夹角的对应关系,所述样本长度是标准立体图形中指定轮廓点与中心点构成的线段的长度,所述样本夹角是所述线段与参照线的夹角。In one example, the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure includes: a correspondence between a sample length and a sample angle, and the sample length is a specified contour point in the standard solid figure. The length of the line segment formed by the center point, which is the angle between the line segment and the reference line.
在该实施例中,待绘制立体图形所使用的第一二维坐标系与标准立体图形所使用的第二二维坐标系之间满足指定关系。所谓指定关系,可以是第一二维坐标系的X轴与第二二维坐标系的X轴重合或平行,第一二维坐标系的Y轴与第二二维坐标系的Y轴重合或平行。In this embodiment, the first two-dimensional coordinate system used by the stereoscopic graphics to be drawn satisfies the specified relationship with the second two-dimensional coordinate system used by the standard solid graphics. The specified relationship may be that the X axis of the first two-dimensional coordinate system coincides or is parallel with the X axis of the second two-dimensional coordinate system, and the Y axis of the first two-dimensional coordinate system coincides with the Y axis of the second two-dimensional coordinate system or parallel.
预设参照物可以是参照线,例如,参照线可以是二维坐标系中的某一坐标轴。参照关系可以是标准立体图形中指定轮廓点与中心点构成的线段与参照线的样本夹角。The preset reference may be a reference line, for example, the reference line may be one of the two-dimensional coordinate systems. The reference relationship may be the angle between the line segment formed by the specified contour point and the center point in the standard solid figure and the reference line.
鉴于此,在获取第一点坐标和第二点坐标后,可以计算所述第一点坐标和第二点坐标构成的目标线段的目标长度、以及所述目标线段与所述参照线的目标夹角;从所述样本夹角中,筛选出与所述目标夹角差距最小的样本夹角;将所述目标长度、与筛选出的样本夹角所对应的样本长度相比,获得待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。In view of this, after acquiring the first point coordinate and the second point coordinate, the target length of the target line segment formed by the first point coordinate and the second point coordinate, and the target clip of the target line segment and the reference line may be calculated. An angle of the sample that is the smallest angle from the target is selected from the angle between the samples; and the target length is compared with the length of the sample corresponding to the angle of the selected sample to obtain a solid to be drawn The first scale of the bottom contour of the graphic relative to the bottom contour of the standard solid graphic.
本实施例中,若目标夹角与样本夹角的差距最小,则可以认为筛选出的样本夹角所对应的投影点,是与第二坐标点关系最接近的点。筛选出的样本夹角所对应的投影点与中心点构成的线段、与第一点坐标和第二点坐标构成的线段具有关联关系,因此,可以将目标长度与筛选出的样本夹角所对应的样本长度相比,从而获得待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。 In this embodiment, if the difference between the target angle and the sample angle is the smallest, it can be considered that the projection point corresponding to the selected sample angle is the closest point to the second coordinate point. The line segment formed by the selected sample angle and the center point has a relationship with the line segment formed by the first point coordinate and the second point coordinate. Therefore, the target length can be matched with the angle of the selected sample. The sample length is compared to thereby obtain a first scaling of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid image.
进一步的,为了提高判断的准确性,在筛选样本夹角时,可以从样本夹角中,筛选出与目标夹角差距最小且差距在预设夹角内的样本夹角。Further, in order to improve the accuracy of the judgment, when screening the angle of the sample, the angle between the sample and the angle of the sample within the preset angle can be selected from the angle of the sample.
由上述实施例可见,通过夹角的方式建立标准立体图形与第一点坐标和第二点坐标之间的关系,进而确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例,可以提高比例的确认效率。It can be seen from the above embodiment that the relationship between the first three-dimensional figure and the first point coordinate and the second point coordinate is established by the angle, and then the first surface contour of the solid image to be drawn is determined relative to the bottom surface contour of the standard three-dimensional figure. The scaling ratio can increase the efficiency of the ratio confirmation.
由于待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例确定,且将第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,则可以根据标准立体图形的底面轮廓以及第一缩放比例,绘制待绘制立体图形的底面轮廓。Determining, according to a first scaling ratio of a bottom surface contour of the stereoscopic graphic to be drawn, relative to a bottom surface contour of the standard solid graphics, and using the first point coordinate and the second point coordinate as the center point coordinates and the contour point of the bottom surface contour in the solid image to be drawn, respectively. The coordinates can be used to draw the bottom contour of the solid image to be drawn according to the bottom contour of the standard solid figure and the first zoom ratio.
在一个可选的实现方式中,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系还包括:绘制所述标准立体图形中底面轮廓所需的绘制信息。In an optional implementation manner, the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further includes: drawing information required to draw the bottom surface contour in the standard solid figure.
鉴于此,在绘制底面轮廓时,可以基于所述第一缩放比例对所述绘制信息中的长度进行缩放;利用缩放获得的长度以及绘制信息中的方向,绘制所述待绘制立体图形的底面轮廓。In view of this, when drawing the bottom surface contour, the length in the drawing information may be scaled based on the first scaling ratio; using the length obtained by scaling and the direction in the drawing information, drawing the bottom surface contour of the stereoscopic graphic to be drawn .
例如,若所述标准三维体为圆柱体或圆锥体,所述绘制信息包括所述标准立体图形中底面轮廓的最长半径的长度和延伸方向、以及最短半径的长度和延伸方向,则基于所述第一缩放比例对所述绘制信息中的最短半径的长度和最长半径的长度进行缩放,获得缩放后的最短半径长度和最长半径长度;基于缩放后的最短半径长度以及绘制信息中最短半径的延伸方向、以及缩放后的最长半径长度以及绘制信息中最长半径的延伸方向,绘制所述待绘制立体图形的底面轮廓。For example, if the standard three-dimensional body is a cylinder or a cone, the drawing information includes a length and an extending direction of the longest radius of the bottom surface contour in the standard solid figure, and a length and an extending direction of the shortest radius, based on The first scaling scales the length of the shortest radius and the length of the longest radius in the drawing information to obtain the shortest radius length and the longest radius length after scaling; the shortest radius length after scaling and the shortest drawing information The extending direction of the radius, and the length of the longest radius after scaling and the extending direction of the longest radius in the drawing information are used to draw the bottom surface contour of the solid graphic to be drawn.
其中,最短半径可以是标准立体图形中底面轮廓的中心点到最近轮廓点的距离,最短半径的延伸方向可以是最短半径中某一端点到另一端点的方向。最长半径可以是标准立体图形中底面轮廓的中心点到最远轮廓点的距离,最长半径的延伸方向可以是最长半径中某一端点到另一端点的方向。The shortest radius may be the distance from the center point of the bottom contour of the standard solid figure to the nearest contour point, and the extension direction of the shortest radius may be the direction from one end to the other end of the shortest radius. The longest radius may be the distance from the center point of the bottom contour of the standard solid figure to the farthest contour point, and the extension direction of the longest radius may be the direction from one end to the other end of the longest radius.
又如,若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述绘制信息包括所述标准立体图形中底面轮廓的中心点到各顶点的长度和方向。其中,底面轮廓的顶点可以是底面轮廓中相邻边的交点。鉴于此,基于第一缩放比例对所述绘制信息中长度进行缩放;利用缩放获得的长度以及绘制信息中的方向,绘制所述待绘制立体图形的底面轮廓。For another example, if the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information includes the length and direction of the center point to the vertices of the bottom surface contour in the standard three-dimensional figure. Wherein, the apex of the bottom surface contour may be the intersection of adjacent edges in the bottom surface contour. In view of this, the length in the drawing information is scaled based on the first scaling ratio; the bottom surface contour of the stereoscopic graphic to be drawn is drawn using the length obtained by scaling and the direction in the drawing information.
为了绘制出待绘制立体图形中侧面轮廓,可以预先获取标准立体图形中侧面轮廓的延伸方向。侧面轮廓的延伸方向可以是侧面轮廓中任一端点到另一个端点的方向。由于在投影 条件(预设视角)确定的情况下,标准立体图形中侧面轮廓的延伸方向固定,因此,不管第二点到第三点的方向是否与延伸方向一致,在绘制立体图形中侧面轮廓时,均按照标准立体图形中侧面轮廓的延伸方向绘制。In order to draw the side contours of the solid graphics to be drawn, the extending direction of the side contours in the standard solid graphics may be obtained in advance. The direction in which the side profile extends may be the direction from either end of the side profile to the other end. Due to projection In the case where the condition (predetermined viewing angle) is determined, the extending direction of the side contour in the standard solid figure is fixed, and therefore, regardless of whether the direction of the second point to the third point coincides with the extending direction, when drawing the side contour in the solid figure, Draw according to the extension direction of the side profile in the standard solid figure.
具体的,根据第二点坐标与第三点坐标在侧面轮廓的延伸方向上的投影距离,可以确定待绘制立体图的侧面轮廓长度,基于已绘制的底面轮廓以及确定的侧面轮廓长度和延伸方向,绘制待绘制立体图中其他面的轮廓。Specifically, according to the projection distance of the second point coordinate and the third point coordinate in the extending direction of the side contour, the side contour length of the stereoscopic image to be drawn may be determined, based on the drawn bottom surface contour and the determined side contour length and extending direction, Draw the outline of the other faces in the perspective to be drawn.
接下来,对如何确定预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系、以及标准立体图形中侧面轮廓的延伸方向进行介绍。Next, how to determine the relationship between each specified contour point on the bottom surface contour of the preset standard solid figure and the center point, and the extension direction of the side contour in the standard solid figure are introduced.
本实施例中可以预存至少一种投影条件(预设视角)的样本数据组,样本数据组包括同一种投影条件(预设视角)的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系、以及标准立体图形中侧面轮廓的延伸方向。In this embodiment, at least one type of projection condition (predetermined viewing angle) of the sample data group may be pre-stored, and the sample data group includes the specified contour point and the center point on the bottom surface contour of the standard three-dimensional graphic of the same projection condition (predetermined viewing angle). Relationship, and the direction in which the side contours extend in a standard solid figure.
其中,不同投影条件(预设视角)所对应的投影矩阵可能不同。投影矩阵是用于将三维坐标转换为二维坐标的矩阵。The projection matrix corresponding to different projection conditions (predetermined viewing angles) may be different. The projection matrix is a matrix for converting three-dimensional coordinates into two-dimensional coordinates.
在一个可选的实现方式中,固定存储一种投影条件(预设视角)的样本数据组,每次进行图形绘制时,均采用该样本数据组中的参数进行绘制。In an optional implementation manner, a sample data group of a projection condition (preset angle of view) is fixedly stored, and each time the graphics are drawn, the parameters in the sample data group are used for drawing.
在另一个可选的实现方式中,可以存储多种投影条件(预设视角)对应的样本数据组。在绘制立体图形前,确定样本数据组。例如,基于投影条件(预设视角)设置界面,接收投影条件(预设视角)设置指令,根据所述投影条件(预设视角)设置指令确定投影条件(预设视角),进而确定相应的样本数据组,然后根据确定的样本数据组进行立体图形绘制。设置界面中可以直接以文字的方式描述投影条件(预设视角),也可以每种投影条件(预设视角)所对应的标准立体图形进行提示,便于用户查看每种投影条件(预设视角)的展示效果,从而快速进行投影条件(预设视角)设置。In another optional implementation, a sample data set corresponding to a plurality of projection conditions (predetermined viewing angles) may be stored. Determine the sample data set before drawing the solid figure. For example, based on the projection condition (preset angle of view) setting interface, receiving a projection condition (preset angle of view) setting instruction, determining a projection condition (predetermined angle of view) according to the projection condition (preset angle of view) setting instruction, and further determining a corresponding sample The data set is then subjected to stereoscopic graphics based on the determined sample data set. In the setting interface, the projection conditions (preset viewing angle) can be directly described by text, or the standard stereoscopic graphics corresponding to each projection condition (predetermined viewing angle) can be prompted to facilitate the user to view each projection condition (preset viewing angle). The effect of the display, so that the projection condition (preset angle) setting is quickly performed.
本发明实施例还提供一种样本数据组确定方法。如图3A所示,图3A是本发明根据一示例性实施例示出的一种样本数据组确定方法的流程图,所述方法包括步骤301至304:The embodiment of the invention further provides a sample data group determining method. As shown in FIG. 3A, FIG. 3A is a flowchart of a sample data group determining method according to an exemplary embodiment of the present invention, where the method includes steps 301 to 304:
在步骤301中,将所述标准三维体的底面轮廓进行等分,获得至少两个等分点。In step 301, the bottom surface contour of the standard three-dimensional body is equally divided to obtain at least two halving points.
在该步骤中,可以将标准三维体的底面轮廓进行N等分,获得N个等分点。等分数量决定了等分点的设置密度,在考虑设备处理性能的情况下,等分数量可以尽量大。In this step, the bottom surface contour of the standard three-dimensional body can be N-divided to obtain N equal points. The number of equal divisions determines the setting density of the equal points. When considering the processing performance of the equipment, the number of equal divisions can be as large as possible.
在步骤302中,基于预设视角对应的投影矩阵,确定所述等分点在预设视角所对应的 投影平面的投影点、以及标准三维体底面中心在预设视角所对应的投影平面的投影点,将该等分点对应的投影点确定为所述指定轮廓点,将中心对应的投影点确定为所述中心点。In step 302, based on the projection matrix corresponding to the preset viewing angle, determining that the halving point corresponds to the preset viewing angle a projection point of the projection plane, and a projection point of the projection plane corresponding to the center of the standard three-dimensional body, the projection point corresponding to the sub-point is determined as the specified contour point, and the projection point corresponding to the center is determined as The center point.
实际应用中无需将真正的标准三维体投影到二维平面(投影屏幕),可以利用指定投影条件(预设视角)所对应的投影矩阵,将三维绘图引擎中标准三维体的三维坐标转换为二维坐标,进而基于转换获得的二维坐标,在二维平面中绘制标准立体图形。In practical applications, it is not necessary to project a true standard three-dimensional object onto a two-dimensional plane (projection screen), and the three-dimensional coordinates of the standard three-dimensional body in the three-dimensional drawing engine can be converted into two by using a projection matrix corresponding to a specified projection condition (predetermined viewing angle). The dimensional coordinates, and then based on the two-dimensional coordinates obtained by the transformation, draw a standard solid figure in a two-dimensional plane.
若标准三维体为圆柱体或圆锥体,所述中心点为圆柱体或圆锥体底面圆心在预设视角所对应的投影平面的投影点。若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述中心点为柱体底面中心在预设视角所对应的投影平面的投影点。柱体底面中心,可以是到底面各个顶点距离相等的点,即底面的中心到底面各个顶点的距离相等。由于底面是正多边形,底面中心即正多边形的几何中心。If the standard three-dimensional body is a cylinder or a cone, the center point is a projection point of the center of the cylinder or the center of the cone at a projection plane corresponding to the preset angle of view. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the center point is a projection point of the center of the cylinder bottom surface at a projection plane corresponding to the preset viewing angle. The center of the bottom surface of the cylinder may be a point equal to the distance between the vertices of the bottom surface, that is, the distance from the center of the bottom surface to the apex of the bottom surface is equal. Since the bottom surface is a regular polygon, the center of the bottom surface is the geometric center of the regular polygon.
为了区分等分点对应的投影点以及中心点对应的投影点,可以将该等分点对应的投影点确定为所述指定轮廓点,将中心对应的投影点确定为所述中心点。In order to distinguish the projection point corresponding to the aliquot point and the projection point corresponding to the center point, the projection point corresponding to the quinting point may be determined as the specified contour point, and the projection point corresponding to the center may be determined as the center point.
在步骤303中,基于所确定的指定轮廓点和中心点,确定标准立体图形中所述指定轮廓点与中心点构成的线段的样本长度、以及所述线段与所述参照线的样本夹角、以及绘制所述标准立体图形中底面轮廓所需的绘制信息。In step 303, based on the determined specified contour point and the center point, determining a sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and an angle between the line segment and the sample line of the reference line, And drawing information required to draw a bottom contour in the standard solid figure.
其中,若所述标准三维体为圆柱体或圆锥体,所述绘制信息可以包括所述标准立体图形中底面轮廓的最长半径的长度和延伸方向以及最短半径的长度和延伸方向。若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述绘制信息可以包括所述标准立体图形中底面轮廓的中心点到各顶点的长度和方向。Wherein, if the standard three-dimensional body is a cylinder or a cone, the drawing information may include a length and an extending direction of the longest radius of the bottom surface contour in the standard three-dimensional figure, and a length and an extending direction of the shortest radius. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information may include the length and direction of the center point to the vertices of the bottom surface contour in the standard solid figure.
在步骤304中,基于所确定的指定轮廓点确定标准立体图形中侧面轮廓的延伸方向。In step 304, an extension direction of the side profile in the standard solid figure is determined based on the determined specified contour point.
其中,若所述标准三维体为圆柱体或两底面平行且两底面为相同正多边形的柱体,基于所述标准立体图形的上底面轮廓中指定轮廓点的坐标、以及下底面轮廓中指定轮廓点的坐标,确定标准立体图形中侧面轮廓的延伸方向。Wherein, if the standard three-dimensional body is a cylinder or a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and the specified contour in the lower bottom contour are The coordinates of the point determine the direction in which the side profile extends in the standard solid figure.
若所述标准三维体为圆锥体,基于所述标准立体图形中底面轮廓中指定轮廓点的坐标、以及所述标准立体图形的顶点坐标,确定标准立体图形中轮廓母线的延伸方向。If the standard three-dimensional body is a cone, the extending direction of the contour bus bar in the standard solid figure is determined based on the coordinates of the specified contour point in the bottom surface contour in the standard solid figure and the vertex coordinates of the standard solid figure.
在该实施例中,标准三维体是预先设置的作为基准的三维体,在一个例子中,以三维体为圆柱体为例,圆柱体的半径可以为R0=1,高度为H0=2。由于预设视角已知,则可以获取预设视角下三维空间到二维平面的投影矩阵Mp,基于该投影矩阵,可以根据公式 P投影=P三维*Mp计算标准三维体任意轮廓点坐标在二维平面的投影点坐标。例如,可以基于预设视角对应的投影矩阵,确定等分点在预设视角所对应的投影平面的投影点(为了区分,可以称为指定轮廓点),具体的,确定等分点坐标在预设视角所对应的投影屏幕的投影点坐标(指定轮廓点坐标)。又如,可以基于预设视角对应的投影矩阵,确定三维体底面圆心在预设视角所对应的投影平面的投影点(为了区分,可以称为中心点)。又如,可以基于预设视角对应的投影矩阵,确定标准三维体投影到投影平面的投影点坐标、且该投影点坐标是绘制标准立体图形所需的坐标,进而根据确定的坐标绘制标准立体图形。In this embodiment, the standard three-dimensional body is a three-dimensional body set as a reference in advance. In one example, taking a three-dimensional body as a cylinder, the radius of the cylinder may be R0=1 and the height is H0=2. Since the preset viewing angle is known, the projection matrix Mp of the three-dimensional space to the two-dimensional plane in the preset viewing angle can be obtained, and based on the projection matrix, the coordinate of the arbitrary three-dimensional body can be calculated according to the formula P projection =P three-dimensional *Mp The projection point coordinates of the dimension plane. For example, the projection point of the projection plane corresponding to the preset angle of view may be determined based on the projection matrix corresponding to the preset angle of view (for distinguishing, it may be referred to as a specified contour point), and specifically, determining the contour point coordinates is in advance Set the projection point coordinates of the projection screen corresponding to the angle of view (specify the contour point coordinates). For another example, the projection point of the projection plane corresponding to the preset perspective can be determined based on the projection matrix corresponding to the preset perspective (which may be referred to as a center point for differentiation). For another example, the projection point coordinate of the standard three-dimensional body projection to the projection plane may be determined based on the projection matrix corresponding to the preset viewing angle, and the projection point coordinate is a coordinate required for drawing the standard solid figure, and then the standard solid figure is drawn according to the determined coordinate. .
如图3B所示,图3B是本发明根据一示例性实施例示出的一种指定轮廓点确定示意图。该示意图以圆柱体为例,将标准圆柱体的底面轮廓等分为N份(为了便于说明,图3B中只列出了圆柱体底面轮廓的部分指定轮廓点),并将等分点在预设视角所对应的投影平面的投影点确定为指定轮廓点,为了方便查看,利用圆点突出显示指定轮廓点。Si为圆柱体图形中上底面轮廓其中一个等分点,Si'为圆柱体图形中下底面轮廓其中一个等分点,O为圆柱体图形中上底面轮廓的中心点。As shown in FIG. 3B, FIG. 3B is a schematic diagram of a specified contour point determination according to an exemplary embodiment of the present invention. The schematic diagram takes a cylinder as an example, and divides the bottom surface contour of the standard cylinder into N parts (for convenience of explanation, only part of the specified contour point of the bottom surface contour of the cylinder is listed in FIG. 3B), and the aliquot is in advance. Let the projection point of the projection plane corresponding to the angle of view be determined as the specified contour point. For the convenience of viewing, the specified contour point is highlighted by using the dot. S i is one of the equal points in the upper and lower contours of the cylinder figure, S i ' is one of the equal points in the lower bottom contour of the cylinder figure, and O is the center point of the upper bottom contour in the cylinder figure.
本实施例中,可以根据指定轮廓点的坐标以及中心点的坐标,确定标准立体图形中所述指定轮廓点与中心点构成的线段的样本长度、所述线段与所述参照线的样本夹角。以指定轮廓点Si为例,指定轮廓点Si的参数包括线段OSi的长度
Figure PCTCN2017104816-appb-000001
以及线段OSi与X轴的夹角θi,可以用{
Figure PCTCN2017104816-appb-000002
θi}表示该参数,0≤i≤N。
In this embodiment, the sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and the sample angle of the line segment and the reference line may be determined according to the coordinates of the specified contour point and the coordinates of the center point. . Taking the specified contour point S i as an example, the parameter specifying the contour point S i includes the length of the line segment OS i
Figure PCTCN2017104816-appb-000001
And the angle θ i and the line segment OS i X axis, can be used {
Figure PCTCN2017104816-appb-000002
θ i } represents the parameter, 0 ≤ i ≤ N.
其中,指定轮廓点的坐标可以通过公式P投影=P三维*Mp计算获得,Mp表示预设视角对应的投影矩阵,P投影表示指定轮廓点的坐标,P三维表示等分点坐标。The coordinates of the specified contour point can be obtained by the formula P projection =P three-dimensional *Mp, the Mp represents the projection matrix corresponding to the preset angle of view, the P projection represents the coordinates of the specified contour point, and the P three-dimensional represents the bisector coordinates.
样本夹角又可以称为投影角度,根据向量积公式可知:The angle of the sample can also be called the projection angle. According to the vector product formula, we can know:
OSi·OX=|OSi||OX|·cosθOS i ·OX=|OS i ||OX|·cosθ
从而可以获得线段OSi与X轴的样本夹角θiThereby, the sample angle θ i of the line segment OS i and the X axis can be obtained:
Figure PCTCN2017104816-appb-000003
Figure PCTCN2017104816-appb-000003
可见,可以获得每个等分点的参数{
Figure PCTCN2017104816-appb-000004
θi},其中,X的坐标可以取值为(1,0)。
It can be seen that the parameters of each aliquot can be obtained {
Figure PCTCN2017104816-appb-000004
θ i }, where the coordinate of X can take a value of (1, 0).
进一步的,预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系还包括:绘制标准立体图形中底面轮廓所需的绘制信息。若标准三维体为圆柱体或圆锥体,绘制信息 可以包括标准立体图形中底面轮廓的最长半径以及最短半径的长度和延伸方向。若标准三维体为两底面平行且两底面为相同正多边形的柱体,绘制信息可以包括标准立体图形中底面轮廓的中心点到各顶点的长度和方向。Further, the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further includes: drawing information required for drawing the bottom surface contour in the standard three-dimensional figure. If the standard three-dimensional body is a cylinder or a cone, draw information It may include the longest radius of the bottom surface profile in the standard solid figure and the length and extension direction of the shortest radius. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the drawing information may include the length and direction of the center point of the bottom surface contour in the standard solid figure to each vertex.
以圆柱体为例,还可以根据指定轮廓点的坐标与中心点的坐标的关系,确定最短半径Min(Ri)以及最长半径Max(Ri)。如图3C所示。Taking a cylinder as an example, the shortest radius Min(Ri) and the longest radius Max(Ri) can also be determined according to the relationship between the coordinates of the specified contour point and the coordinates of the center point. As shown in Figure 3C.
作为一种优选方式,标准立体图形所使用的第二二维坐标系与标准立体图形满足:最长半径与第二二维坐标系中其中一坐标轴重合,最短半径与第二二维坐标系中另一坐标轴重合,底面轮廓的中心点与第二二维坐标系原点重合,则可以大大减少计算量,节约计算时间。其中,如果最长半径与最短半径刚好分别与坐标轴重合,则最短半径又可以称为短轴半径,最长半径又可以称为长轴半径。As a preferred mode, the second two-dimensional coordinate system used by the standard solid figure and the standard three-dimensional figure satisfy that the longest radius coincides with one of the second two-dimensional coordinate systems, and the shortest radius and the second two-dimensional coordinate system The other coordinate axes coincide, and the center point of the bottom contour coincides with the origin of the second two-dimensional coordinate system, which can greatly reduce the calculation amount and save the calculation time. Wherein, if the longest radius and the shortest radius coincide with the coordinate axes respectively, the shortest radius may be referred to as a short axis radius, and the longest radius may also be referred to as a long axis radius.
若标准三维体为圆柱体或两底面平行且两底面为相同正多边形的柱体,可以基于所述标准立体图形的上底面轮廓中指定轮廓点的坐标、以及下底面轮廓中指定轮廓点的坐标,确定标准立体图形中侧面轮廓的延伸方向。If the standard three-dimensional body is a cylinder or a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and the coordinates of the specified contour point in the lower bottom surface contour may be used. Determine the direction in which the side profile extends in the standard solid figure.
由于标准立体图形的上底面轮廓与下底面轮廓平行,因此,上底面轮廓中某指定轮廓点与下底面轮廓中相应轮廓点构成的线段、与上底面轮廓中其他指定轮廓点与下底面轮廓中相应轮廓点构成的线段平行,因此任何线段的延伸方向均与标准立体图形中侧面轮廓的延伸方向相同。例如根据Si和Si'的坐标可以确定标准立体图形中侧面轮廓的延伸方向。如图3B所示,延伸方向为Y轴的正方向或负方向。Since the upper bottom surface contour of the standard solid figure is parallel to the lower bottom surface contour, a line segment formed by a specified contour point and a lower contour contour in the upper bottom contour, and other specified contour points and lower bottom contours in the upper bottom contour The line segments formed by the corresponding contour points are parallel, so any line segment extends in the same direction as the side profile in the standard solid figure. For example, the direction of extension of the side profile in the standard solid figure can be determined from the coordinates of S i and S i '. As shown in FIG. 3B, the extending direction is the positive or negative direction of the Y-axis.
若标准三维体为圆锥体,可以基于标准立体图形中底面轮廓中投影点坐标、以及标准立体图形的顶点坐标,确定标准立体图形的轮廓母线的延伸方向。If the standard three-dimensional body is a cone, the extending direction of the contour bus bar of the standard three-dimensional figure can be determined based on the coordinates of the projection point in the bottom surface contour of the standard solid figure and the vertex coordinates of the standard solid figure.
接着,为了方便理解,本发明实施例以一个具体应用实例介绍绘图过程中如何绘制待绘制立体图形。如图3C所示,图3C是本发明根据一示例性实施例示出的一种圆柱体图形对照示意图。在该示意图中,待绘制圆柱体图形所使用的第一二维坐标系与标准圆柱体图形所使用的第二二维坐标系满足指定关系。Then, in order to facilitate understanding, the embodiment of the present invention introduces how to draw a stereoscopic graphic to be drawn in a drawing process with a specific application example. As shown in FIG. 3C, FIG. 3C is a schematic diagram of a cylindrical figure comparison according to an exemplary embodiment of the present invention. In the diagram, the first two-dimensional coordinate system used to draw the cylinder pattern satisfies the specified relationship with the second two-dimensional coordinate system used by the standard cylinder pattern.
在鼠标拖拽绘制过程中,获取P1点坐标和P2点坐标,将P1点坐标和P2点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,则P1点坐标对应于标准圆柱体图形中的O点,为了找出标准圆柱体图形中与P2点对应的指定轮廓点,可以计算线段P2P1与OX的夹角∠P2P1X,并从样本夹角中筛选出与∠P2P1X差距最小的样本夹角。记α=∠P2P1X,则{Δi=|θi-α|,0≤i≤N},当Δi取得最小值时的第i个投影点即为与P2点对应 的投影点Si,进而确定与线段P2P1对应的样本长度
Figure PCTCN2017104816-appb-000005
In the mouse dragging process, the P1 point coordinates and the P2 point coordinates are obtained, and the P1 point coordinates and the P2 point coordinates are respectively taken as the center point coordinates and the contour point coordinates of the bottom surface contour in the solid figure to be drawn, and the P1 point coordinates correspond to the standard. The O point in the cylinder figure, in order to find the specified contour point corresponding to the P2 point in the standard cylinder figure, the angle ∠P2P1X of the line segment P2P1 and OX can be calculated, and the minimum gap from the 夹P2P1X is selected from the sample angle. The angle of the sample. Let α=∠P2P1X, then {Δi=|θi-α|, 0≤i≤N}, the ith projection point when Δi takes the minimum value is the projection point Si corresponding to the P2 point, and then determine the line segment Sample length corresponding to P2P1
Figure PCTCN2017104816-appb-000005
至此,可以根据以下公式确定第一缩放比例k1:At this point, the first scaling ratio k1 can be determined according to the following formula:
Figure PCTCN2017104816-appb-000006
Figure PCTCN2017104816-appb-000006
然后,基于第一缩放比例对绘制信息中的最短半径和最长半径进行缩放,获得目标短半径k1*Min(Ri)、以及目标长半径k1*Max(Ri);并利用目标短半径k1*Min(Ri)以及目标长半径k1*Max(Ri)绘制待绘制圆柱体图形的底面轮廓,结合P3点坐标以及标准圆柱体图形中侧面轮廓的延伸方向,绘制其他面轮廓。Then, the shortest radius and the longest radius in the drawing information are scaled based on the first scaling, obtaining the target short radius k1*Min(R i ), and the target long radius k1*Max(R i ); and using the target short radius K1*Min(R i ) and the target long radius k1*Max(R i ) are used to draw the bottom surface contour of the cylinder figure to be drawn, and the other surface contours are drawn by combining the P3 point coordinates and the extending direction of the side contours in the standard cylinder figure.
相关技术中,往往通过二维绘图引擎绘制不可转动的立体图形,例如采用两点法绘制;也可以通过三维绘图引擎绘制可以转动的立体图形,例如,用户手动输入立体图形的三维参数,三维绘图引擎即可绘制出相应的立体图形。可以理解的是,二维绘图引擎和三维绘图引擎绘制出的图为二维平面图。二维绘图引擎绘制出的是固定投影条件(预设视角)的立体图形,因此不可转动。而在三维绘图引擎中,三维绘图引擎可以根据旋转操作指令绘制出不同显示视角下的立体图形。In the related art, a non-rotatable solid figure is often drawn by a two-dimensional drawing engine, for example, by a two-point method; a three-dimensional drawing engine can also be used to draw a stereoscopic graphic that can be rotated, for example, a user manually inputs a three-dimensional parameter of a three-dimensional figure, and three-dimensional drawing. The engine can draw the corresponding solid graphics. It can be understood that the two-dimensional drawing engine and the three-dimensional drawing engine draw a picture as a two-dimensional plan. The 2D drawing engine draws a solid figure with fixed projection conditions (preset angle of view) and therefore cannot be rotated. In the 3D drawing engine, the 3D drawing engine can draw stereoscopic graphics with different display angles according to the rotation operation instructions.
然而,二维绘图引擎和三维绘图引擎都独立使用,无法实现利用二维绘图引擎绘制出立体图形后,利用三维绘图引擎展示不同显示视角下的立体图形。用户只能分别利用二维绘图引擎和三维绘图引擎进行绘制,绘图效率低,且用户体验差。However, the two-dimensional drawing engine and the three-dimensional drawing engine are used independently, and it is impossible to realize the three-dimensional drawing engine to display the three-dimensional graphics and display the three-dimensional graphics in different display viewing angles. Users can only draw with the 2D drawing engine and 3D drawing engine respectively, which has low drawing efficiency and poor user experience.
为此,本发明实施例还提供一种确定三维参数的方法,所述方法:To this end, an embodiment of the present invention further provides a method for determining a three-dimensional parameter, the method:
S1:根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的长度和延伸方向,确定待绘制立体图形的侧面轮廓相对于标准立体图形的侧面轮廓的第二缩放比例。S1: determining, according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure, determining a second zoom of the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure proportion.
其中,可以确定第二点坐标与第三点坐标在延伸方向上的投影距离,将投影距离与标准立体图形中侧面轮廓的长度相比,可以获得待绘制立体图形的侧面轮廓相对于标准立体图形的侧面轮廓的第二缩放比例。Wherein, the projection distance of the second point coordinate and the third point coordinate in the extending direction may be determined, and the projection distance may be compared with the length of the side contour in the standard solid figure, and the side contour of the solid figure to be drawn may be obtained relative to the standard solid figure. The second scale of the side profile.
S2:获取利用三维绘图引擎绘制所述标准立体图形时所需的三维参数。S2: Obtain a three-dimensional parameter required when drawing the standard solid figure by using a three-dimensional drawing engine.
其中,若标准三维体是圆柱体或圆锥体时,利用三维绘图引擎绘制所述标准立体图形时所需的三维参数包括圆柱体或圆锥体底面圆半径以及圆柱体或圆锥体的高。若标准三维体为两底面平行且两底面为相同正多边形的柱体,则利用三维绘图引擎绘制所述标准立体图形 时所需的三维参数包括圆柱体可以是棱线长度。例如,柱体为底面为正方形的柱体时,三维参数可以是底面边长以及高。Wherein, if the standard three-dimensional body is a cylinder or a cone, the three-dimensional parameters required to draw the standard solid figure by using the three-dimensional drawing engine include the radius of the cylinder or the radius of the bottom surface of the cone and the height of the cylinder or the cone. If the standard three-dimensional body is a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the standard three-dimensional graphics are drawn by using a three-dimensional drawing engine. The three-dimensional parameters required when the cylinder is included may be the length of the ridge. For example, when the cylinder is a cylinder with a square bottom surface, the three-dimensional parameter may be the length of the bottom side and the height.
S3:基于所述第一缩放比例和所述第二缩放比例,对所述三维参数进行缩放。S3: Scaling the three-dimensional parameter based on the first scaling ratio and the second scaling ratio.
其中,可以利用第一缩放比例对三维体的底面三维参数进行缩放,利用第二缩放比例对三维体的高进行缩放。Wherein, the bottom surface three-dimensional parameter of the three-dimensional body can be scaled by using the first scaling ratio, and the height of the three-dimensional body is scaled by the second scaling ratio.
以圆柱体为例,假设标准圆柱体的底面半径为R0、高为H0,第一缩放比例为
Figure PCTCN2017104816-appb-000007
第二缩放比例为
Figure PCTCN2017104816-appb-000008
则待绘制圆柱体图形所对应的圆柱体的三维参数:底面半径为R=R0*k1、高为H=H0*k2。
Taking a cylinder as an example, assume that the radius of the bottom surface of the standard cylinder is R0 and the height is H0. The first scaling ratio is
Figure PCTCN2017104816-appb-000007
The second scaling is
Figure PCTCN2017104816-appb-000008
Then, the three-dimensional parameters of the cylinder corresponding to the cylinder pattern to be drawn are: the radius of the bottom surface is R=R0*k1, and the height is H=H0*k2.
S4:将缩放获得的三维参数输入三维绘图引擎。S4: Input the 3D parameters obtained by the zoom into the 3D drawing engine.
鉴于此,三维绘图引擎可以根据缩放获得的三维参数绘制所述待绘制立体图形;接收对所述待绘制立体图形的旋转操作指令;根据所述旋转操作指令变换所述待绘制立体图形所对应的三维体的显示视角;绘制所述三维体在该显示视角下的立体图形。In view of this, the three-dimensional drawing engine may draw the stereoscopic graphics to be drawn according to the three-dimensional parameters obtained by the scaling; receive a rotation operation instruction for the stereoscopic graphics to be drawn; and transform the corresponding corresponding to the stereoscopic graphics to be drawn according to the rotation operation instruction. a viewing angle of the three-dimensional body; drawing a three-dimensional figure of the three-dimensional body at the viewing angle of the display.
可见,本发明实施例根据显示视角的变化,实时绘制变化后显示视角下的立体图形,对立体图形的显示更直观,用户体验较好。It can be seen that, according to the change of the display angle of view, the embodiment of the present invention draws the stereoscopic graphics under the changed viewing angle in real time, and the display of the stereoscopic graphics is more intuitive and the user experience is better.
以上实施例中的各种技术特征可以任意进行组合,只要特征之间的组合不存在冲突或矛盾,但是限于篇幅,未进行一一描述,因此上述实施方式中的各种技术特征的任意进行组合也属于本说明书公开的范围。The various technical features in the above embodiments may be arbitrarily combined, as long as there is no conflict or contradiction between the combinations of the features, but the description is not limited, and thus the various technical features in the above embodiments are combined arbitrarily. It also falls within the scope of this specification.
如图4所示,图4是本发明根据一示例性实施例示出的另一种立体图形绘制方法的流程图,该方法包括以下步骤:As shown in FIG. 4, FIG. 4 is a flowchart of another method for drawing a solid figure according to an exemplary embodiment of the present invention, the method includes the following steps:
在步骤401中,获取第一点坐标和第二点坐标。In step 401, a first point coordinate and a second point coordinate are acquired.
在步骤402中,计算所述第一点坐标和第二点坐标构成的目标线段的目标长度、以及所述目标线段与预设的参照线的目标夹角。In step 402, a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a target angle of the target line segment and the preset reference line are calculated.
在步骤403中,从预设对应关系中,筛选出与所述目标夹角差距最小的样本夹角。In step 403, from the preset correspondence, the angle between the samples having the smallest angle with the target is selected.
其中,预先配置有样本长度和样本夹角的对应关系,所述样本长度是标准立体图形中底面轮廓上指定轮廓点与中心点构成的线段的长度,所述样本夹角是所述线段与所述参照线的夹角。Wherein, the correspondence between the sample length and the sample angle is pre-configured, and the sample length is the length of the line segment formed by the specified contour point and the center point on the bottom surface contour in the standard solid figure, and the sample angle is the line segment and the The angle between the reference lines.
在步骤404中,将所述目标长度与筛选出的样本夹角所对应的样本长度相比,获得待 绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。In step 404, the target length is compared with the sample length corresponding to the angle of the selected sample, and is obtained. A first scaling ratio of the bottom surface contour of the solid figure relative to the bottom surface contour of the standard solid figure is drawn.
在步骤405中,根据第一点坐标、第二点坐标以及所述第一缩放比例绘制所述待绘制立体图形的底面轮廓。In step 405, the bottom surface contour of the stereoscopic graphic to be drawn is drawn according to the first point coordinate, the second point coordinate, and the first scaling.
在步骤406中,获取第三点坐标。In step 406, the third point coordinates are acquired.
在一个例子中,执行完步骤406后,可以执行步骤407,也可以执行步骤408。步骤407和步骤408之间没有先后执行顺序,可以先执行步骤407,后执行步骤408;也可以先执行步骤408,后执行步骤407,在此不做限制。在一个例子中,步骤406可以是执行步骤407和执行步骤408的触发条件。在另一个例子中,步骤407可以是执行步骤408的触发条件等。In an example, after step 406 is performed, step 407 may be performed, or step 408 may be performed. There is no sequence of execution between step 407 and step 408. Step 407 may be performed first, and then step 408 may be performed. Step 408 may be performed first, and then step 407 is performed, and no limitation is imposed here. In one example, step 406 can be to perform step 407 and perform the triggering condition of step 408. In another example, step 407 can be to perform the trigger condition of step 408, and the like.
在步骤407中,根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。In step 407, the contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
在步骤408中,根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的长度和延伸方向,确定待绘制立体图形的侧面轮廓相对于标准立体图形的侧面轮廓的第二缩放比例。In step 408, determining the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure. The second scaling.
在步骤409中,获取利用三维绘图引擎绘制所述标准立体图形时所需的三维参数。In step 409, three-dimensional parameters required to draw the standard solid figure using the three-dimensional drawing engine are obtained.
其中,步骤409与步骤407和408的执行顺序可以不做限定。在一个例子中,可以将步骤407作为步骤409的触发条件,即在绘制待绘制立体图中其他面的轮廓后,执行步骤409;在另一个例子中,可以将步骤408作为步骤409的触发条件,即在确定第二缩放比例后,执行步骤409等等,还可以将其他条件作为执行步骤409的触发条件,在此不一一列举。The order of execution of step 409 and steps 407 and 408 may not be limited. In an example, step 407 may be used as the trigger condition of step 409, that is, after drawing the contours of other faces in the stereogram to be drawn, step 409 is performed; in another example, step 408 may be used as the trigger condition of step 409. That is, after the second scaling is determined, step 409 and the like are performed, and other conditions may be used as the triggering conditions for performing step 409, which are not enumerated here.
在步骤410中,基于所述第一缩放比例和所述第二缩放比例,对所述三维参数进行缩放。In step 410, the three-dimensional parameter is scaled based on the first scaling ratio and the second scaling ratio.
其中,待步骤404获得第一缩放比例,步骤408获得第二缩放比例,步骤409获得三维参数时,可以执行步骤410。The step 404 is to obtain the first zoom ratio, the step 408 is to obtain the second zoom ratio, and when the step 409 obtains the three-dimensional parameter, step 410 can be performed.
在步骤411中,将缩放获得的三维参数输入三维绘图引擎。In step 411, the three-dimensional parameters obtained by the scaling are input to the three-dimensional drawing engine.
其中,步骤401至步骤411与前述步骤201至204、以及301至304相关技术相同,在此不再一一赘述。The steps 401 to 411 are the same as the related technologies of the foregoing steps 201 to 204 and 301 to 304, and are not further described herein.
由上述实施例可见,本实施例通过两点绘制立体图形的一个底面轮廓,并通过第三点绘制立体图形的其他面轮廓,从而实现立体图形的绘制,由于用户可以通过两点控制立体图形中底面轮廓大小,通过第三个点控制立体图形中其他面轮廓,因此可以积极响应绘图指令, 绘制出用户期望绘制的立体图形,进而提高绘制立体图形的准确性。并且,根据绘制的立方体图形可以获得相应三维体的三维尺寸,并将三维尺寸传输至三维绘图引擎,通过三维绘图引擎绘制该三维体在各种视角下立体图形,实现二维绘图工具和三维绘图引擎的结合。It can be seen from the above embodiment that the present embodiment draws a bottom surface contour of the three-dimensional figure by two points, and draws other surface contours of the three-dimensional figure through the third point, thereby realizing the drawing of the three-dimensional figure, since the user can control the three-dimensional figure through two points. The size of the bottom surface, through the third point to control the other contours in the solid figure, so you can actively respond to drawing instructions. Draw the three-dimensional graphics that the user expects to draw, and improve the accuracy of drawing the stereoscopic graphics. Moreover, according to the drawn cube graphic, the three-dimensional size of the corresponding three-dimensional body can be obtained, and the three-dimensional size is transmitted to the three-dimensional drawing engine, and the three-dimensional drawing is used to draw the three-dimensional body in various angles, and the two-dimensional drawing tool and the three-dimensional drawing are realized. The combination of engines.
与前述立体图形绘制方法的实施例相对应,本发明还提供了立体图形绘制装置、装置所应用的电子设备以及计算存储介质的实施例。Corresponding to the embodiment of the aforementioned stereoscopic graphics rendering method, the present invention also provides a stereoscopic graphics rendering device, an electronic device to which the device is applied, and an embodiment of a computing storage medium.
本发明立体图形绘制装置的实施例可以应用在计算机设备。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在立体图形绘制的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图5所示,为本发明立体图形绘制装置所在计算机设备的一种硬件结构图,除了图5所示的处理器510、内存530、网络接口520、以及非易失性存储器540之外,实施例中装置531所在的计算机设备通常根据该服务器的实际功能,还可以包括其他硬件,对此不再赘述。Embodiments of the stereoscopic graphics rendering apparatus of the present invention can be applied to computer equipment. The device embodiment may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking the software implementation as an example, as a logical means, a processor drawn by the stereoscopic graphics is formed by reading a corresponding computer program instruction in the non-volatile memory into the memory. From the hardware level, as shown in FIG. 5, it is a hardware structure diagram of a computer device where the stereoscopic graphics drawing device of the present invention is located, except for the processor 510, the memory 530, the network interface 520, and the nonvolatile memory shown in FIG. 5. In addition to the memory 540, the computer device in which the device 531 is located in the embodiment may further include other hardware according to the actual function of the server, and details are not described herein again.
如图6所示,图6是本发明根据一示例性实施例示出的一种立体图形绘制装置的框图,所述装置包括:坐标获取模块610、比例确定模块620以及图形绘制模块630。As shown in FIG. 6 , FIG. 6 is a block diagram of a stereoscopic graphics rendering apparatus according to an exemplary embodiment of the present invention. The apparatus includes a coordinate acquiring module 610 , a scaling determining module 620 , and a graphics rendering module 630 .
其中,坐标获取模块610,用于获取第一点坐标、第二点坐标、第三点坐标。The coordinate acquiring module 610 is configured to acquire first point coordinates, second point coordinates, and third point coordinates.
比例确定模块620,用于将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。The ratio determining module 620 is configured to respectively use the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the stereoscopic graphic to be drawn, and combined with the bottom surface contour of the preset standard three-dimensional graphic The relationship between the contour point and the center point is specified, and the first scaling ratio of the bottom surface contour of the solid figure to be drawn with respect to the bottom surface contour of the standard solid figure is determined.
图形绘制模块630,用于基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。a graphic drawing module 630, configured to draw a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio; a distance according to the second point coordinate and the third point coordinate, and an extending direction of the side contour in the standard solid graphic , draw the outline of the other faces in the stereogram to be drawn.
在一个可选的实现方式中,所述标准立体图形是在二维平面上以预设视角展示标准三维体的图形,所述标准三维体包括圆柱体、圆锥体、或两底面平行且两底面为相同正多边形的柱体,若所述标准三维体为圆柱体或圆锥体,所述侧面轮廓为轮廓母线;若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述侧面轮廓为侧面棱线。In an optional implementation manner, the standard three-dimensional figure is a graphic that displays a standard three-dimensional body on a two-dimensional plane, and the standard three-dimensional body includes a cylinder, a cone, or two bottom surfaces and two bottom surfaces. a cylinder of the same regular polygon, if the standard three-dimensional body is a cylinder or a cone, the side contour is a contour bus; if the standard three-dimensional body is a cylinder with two bottom surfaces parallel and two bottom surfaces being the same regular polygon, The side profile is a side ridgeline.
在一个可选的实现方式中,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系包括:样本长度和样本夹角的对应关系,所述样本长度是标准立体图形中指定轮廓点与中心点构成的线段的长度,所述样本夹角是所述线段与预设的参照线的夹角。 In an optional implementation manner, the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure includes: a correspondence between a sample length and a sample angle, and the sample length is a standard solid figure. The length of the line segment formed by the contour point and the center point is specified, and the sample angle is an angle between the line segment and the preset reference line.
在一个可选的实现方式中,所述装置还包括关系确定模块(图6未示出),所述关系确定模块用于:In an optional implementation manner, the apparatus further includes a relationship determining module (not shown in FIG. 6), where the relationship determining module is configured to:
将所述标准三维体的底面轮廓进行等分,获得至少两个等分点。The bottom surface contour of the standard three-dimensional body is equally divided to obtain at least two halving points.
基于预设视角对应的投影矩阵,确定所述等分点在预设视角所对应的投影平面的投影点、以及标准三维体底面中心在预设视角所对应的投影平面的投影点,将该等分点对应的投影点确定为所述指定轮廓点,将中心对应的投影点确定为所述中心点。Determining, according to a projection matrix corresponding to the preset viewing angle, a projection point of the projection plane corresponding to the projection plane corresponding to the preset viewing angle, and a projection point of the projection plane corresponding to the center of the standard three-dimensional body at the preset viewing angle, The projection point corresponding to the point is determined as the specified contour point, and the projection point corresponding to the center is determined as the center point.
基于所确定的指定轮廓点和中心点,确定标准立体图形中所述指定轮廓点与中心点构成的线段的样本长度、以及所述线段与所述参照线的样本夹角。And determining, according to the determined specified contour point and the center point, a sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and an angle between the line segment and the sample line of the reference line.
在一个可选的实现方式中,所述比例确定模块620包括:In an optional implementation manner, the ratio determining module 620 includes:
信息计算子模块,用于计算所述第一点坐标和第二点坐标构成的目标线段的目标长度、以及所述目标线段与所述参照线的目标夹角。The information calculation sub-module is configured to calculate a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a target angle between the target line segment and the reference line.
夹角筛选子模块,用于从所述样本夹角中,筛选出与所述目标夹角差距最小的样本夹角。The angle screening sub-module is configured to filter, from the angle of the sample, a sample angle that is the smallest difference from the target angle.
比例确定子模块,用于将所述目标长度与筛选出的样本夹角所对应的样本长度相比,获得待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。The ratio determining sub-module is configured to obtain a first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid graphic by comparing the target length with a sample length corresponding to the selected sample angle.
在一个可选的实现方式中,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系还包括:绘制所述标准立体图形中底面轮廓所需的绘制信息;若所述标准三维体为圆柱体或圆锥体,所述绘制信息包括所述标准立体图形中底面轮廓的最长半径以及最短半径的长度和延伸方向;若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述绘制信息包括所述标准立体图形中底面轮廓的中心点到各顶点的长度和方向。In an optional implementation manner, the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further includes: drawing information required to draw the bottom surface contour in the standard three-dimensional graphic; The standard three-dimensional body is a cylinder or a cone, and the drawing information includes a longest radius of the bottom surface contour and a length and an extending direction of the shortest radius in the standard solid figure; if the standard three-dimensional body is two bottom surfaces parallel and two bottom surfaces For a cylinder of the same regular polygon, the rendering information includes the length and direction of the center point to the vertices of the bottom surface contour in the standard solid figure.
所述图形绘制模块具体用于:基于所述第一缩放比例对所述绘制信息中的长度进行缩放。利用缩放获得的长度以及绘制信息中的方向,绘制所述待绘制立体图形的底面轮廓。The graphic drawing module is specifically configured to: scale the length in the drawing information based on the first scaling ratio. The bottom surface contour of the stereoscopic graphic to be drawn is drawn by the length obtained by the scaling and the direction in the drawing information.
在一个可选的实现方式中,若所述标准三维体为圆柱体或两底面平行且两底面为相同正多边形的柱体,所述装置还包括第一方向确定模块(图6未示出),用于:基于所述标准立体图形的上底面轮廓中指定轮廓点的坐标、以及下底面轮廓中指定轮廓点的坐标,确定标准立体图形中侧面轮廓的延伸方向。In an optional implementation manner, if the standard three-dimensional body is a cylinder or a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the apparatus further includes a first direction determining module (not shown in FIG. 6). And for determining an extension direction of the side contour in the standard solid figure based on coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and coordinates of the specified contour point in the lower bottom surface contour.
在一个可选的实现方式中,若所述标准三维体为圆锥体,所述装置还包括第二方向确定模块(图6未示出),用于:基于所述标准立体图形中底面轮廓中指定轮廓点的坐标、以 及所述标准立体图形的顶点坐标,确定标准立体图形中轮廓母线的延伸方向。In an optional implementation, if the standard three-dimensional body is a cone, the device further includes a second direction determining module (not shown in FIG. 6) for: based on the bottom surface contour in the standard solid graphic Specify the coordinates of the contour point to And the vertex coordinates of the standard solid figure determine the extending direction of the contour bus bar in the standard solid figure.
在一个可选的实现方式中,所述装置还包括参数获取模块、参数缩放模块和参数传输模块(图6未示出)。In an optional implementation manner, the apparatus further includes a parameter acquisition module, a parameter scaling module, and a parameter transmission module (not shown in FIG. 6).
其中,所述比例确定模块,还用于根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的长度和延伸方向,确定待绘制立体图形的侧面轮廓相对于标准立体图形的侧面轮廓的第二缩放比例。The ratio determining module is further configured to determine, according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure, the side contour of the solid graphic to be drawn is relative to the standard The second scaling of the side profile of the solid figure.
参数获取模块,用于获取利用三维绘图引擎绘制所述标准立体图形时所需的三维参数。A parameter acquisition module is configured to acquire a three-dimensional parameter required when the standard three-dimensional graphic is drawn by using a three-dimensional drawing engine.
参数缩放模块,用于基于所述第一缩放比例和所述第二缩放比例,对所述三维参数进行缩放。And a parameter scaling module, configured to scale the three-dimensional parameter based on the first scaling ratio and the second scaling ratio.
参数传输模块,用于将缩放获得的三维参数输入三维绘图引擎。A parameter transmission module for inputting the three-dimensional parameters obtained by the scaling into the three-dimensional drawing engine.
在一个可选的实现方式中,所述装置还包括:In an optional implementation, the apparatus further includes:
绘制模块,用于基于所述三维绘图引擎,利用缩放获得的三维参数绘制所述待绘制立体图形。And a drawing module, configured to draw the stereoscopic graphic to be drawn by using the three-dimensional parameters obtained by the scaling based on the three-dimensional drawing engine.
指令接收模块,用于接收对所述待绘制立体图形的旋转操作指令。And an instruction receiving module, configured to receive a rotation operation instruction for the stereoscopic graphic to be drawn.
视角确定模块,用于根据所述旋转操作指令变换所述待绘制立体图形所对应的三维体的显示视角。The angle of view determining module is configured to transform a display angle of view of the three-dimensional body corresponding to the to-be-drawn three-dimensional figure according to the rotation operation instruction.
所述绘制模块,还用于绘制所述三维体在该显示视角下的立体图形。The drawing module is further configured to draw a three-dimensional figure of the three-dimensional body in the display viewing angle.
相应的,本发明还提供一种电子设备,所述装置包括有处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:Accordingly, the present invention also provides an electronic device, the device comprising a processor; a memory for storing processor-executable instructions; wherein the processor is configured to:
获取第一点坐标、第二点坐标、第三点坐标。Get the first point coordinate, the second point coordinate, and the third point coordinate.
将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure The relationship determines a first scaling of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics.
基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓。Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio.
根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。 The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
进一步的,电子设备可以为智能平板,例如希沃交互智能平板。Further, the electronic device can be a smart tablet, such as a Xiwo interactive smart tablet.
相应的,本发明实施例还提供一种计算机存储介质,所述存储介质中存储有程序指令,所述程序指令包括:Correspondingly, an embodiment of the present invention further provides a computer storage medium, where the storage medium stores program instructions, where the program instructions include:
获取第一点坐标、第二点坐标、第三点坐标。Get the first point coordinate, the second point coordinate, and the third point coordinate.
将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure The relationship determines a first scaling of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics.
基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓。Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio.
根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
本发明实施例可采用在一个或多个其中包含有程序代码的存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机可用存储介质包括永久性和非永久性、可移动和非可移动媒体,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括但不限于:相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。Embodiments of the invention may take the form of a computer program product embodied on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) in which program code is embodied. Computer-usable storage media include both permanent and non-persistent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本发明方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the device embodiment, since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment. The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components displayed as modules may or may not be physical modules, ie may be located A place, or it can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objectives of the solution of the present invention. Those of ordinary skill in the art can understand and implement without any creative effort.
本领域技术人员在考虑说明书及实践这里申请的发明后,将容易想到本发明的其它实施方案。本发明旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本发明未申请的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指 出。Other embodiments of the invention will be apparent to those skilled in the <RTIgt; The present invention is intended to cover any variations, uses, or adaptations of the present invention, which are in accordance with the general principles of the invention and include common general knowledge or conventional technical means in the art that are not claimed. . The specification and examples are to be regarded as illustrative only, and the true scope and spirit of the invention Out.
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It is to be understood that the invention is not limited to the details of the details of The scope of the invention is limited only by the appended claims.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。 The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are made within the spirit and principles of the present invention, should be included in the present invention. Within the scope of protection.

Claims (13)

  1. 一种立体图形绘制方法,其特征在于,所述方法包括:A method for drawing a three-dimensional figure, the method comprising:
    获取第一点坐标、第二点坐标、第三点坐标;Obtaining a first point coordinate, a second point coordinate, and a third point coordinate;
    将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
    基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio;
    根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  2. 根据权利要求1所述的方法,其特征在于,所述标准立体图形是在二维平面上以预设视角展示标准三维体的图形,所述标准三维体包括圆柱体、圆锥体、或两底面平行且两底面为相同正多边形的柱体,若所述标准三维体为圆柱体或圆锥体,所述侧面轮廓为轮廓母线;若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述侧面轮廓为侧面棱线。The method according to claim 1, wherein the standard three-dimensional figure is a graphic showing a standard three-dimensional body on a two-dimensional plane, the standard three-dimensional body comprising a cylinder, a cone, or two bottom surfaces. Parallel and two bottom surfaces are the same regular polygonal cylinder. If the standard three-dimensional body is a cylinder or a cone, the side contour is a contour bus; if the standard three-dimensional body is two bottom surfaces parallel and the two bottom surfaces are the same regular polygon The column has a side profile which is a side ridge.
  3. 根据权利要求2所述的方法,其特征在于,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系包括:样本长度和样本夹角的对应关系,所述样本长度是标准立体图形中指定轮廓点与中心点构成的线段的长度,所述样本夹角是所述线段与预设的参照线的夹角。The method according to claim 2, wherein the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure comprises: a correspondence between a sample length and a sample angle, the sample length It is the length of the line segment formed by the specified contour point and the center point in the standard solid figure, and the sample angle is the angle between the line segment and the preset reference line.
  4. 根据权利要求3所述的方法,其特征在于,所述样本长度和样本夹角的对应关系的确定步骤包括:The method according to claim 3, wherein the determining step of the correspondence between the sample length and the angle of the sample comprises:
    将所述标准三维体的底面轮廓进行等分,获得至少两个等分点;Dividing the bottom surface contour of the standard three-dimensional body to obtain at least two equal points;
    基于预设视角对应的投影矩阵,确定所述等分点在预设视角所对应的投影平面的投影点、以及标准三维体底面中心在预设视角所对应的投影平面的投影点,将该等分点对应的投影点确定为所述指定轮廓点,将中心对应的投影点确定为所述中心点;Determining, according to a projection matrix corresponding to the preset viewing angle, a projection point of the projection plane corresponding to the projection plane corresponding to the preset viewing angle, and a projection point of the projection plane corresponding to the center of the standard three-dimensional body at the preset viewing angle, The projection point corresponding to the point is determined as the specified contour point, and the projection point corresponding to the center is determined as the center point;
    基于所确定的指定轮廓点和中心点,确定标准立体图形中所述指定轮廓点与中心点构成的线段的样本长度、以及所述线段与所述参照线的样本夹角。And determining, according to the determined specified contour point and the center point, a sample length of the line segment formed by the specified contour point and the center point in the standard solid figure, and an angle between the line segment and the sample line of the reference line.
  5. 根据权利要求3所述的方法,其特征在于,所述将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例,包括:The method according to claim 3, wherein the first point coordinate and the second point coordinate are respectively used as a center point coordinate and a contour point coordinate of a bottom surface contour in the solid figure to be drawn, and combined with the preset The relationship between each specified contour point and the center point on the bottom surface contour of the standard solid figure determines the first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid graphic, including:
    计算所述第一点坐标和第二点坐标构成的目标线段的目标长度、以及所述目标线段与所述参照线的目标夹角; Calculating a target length of the target line segment formed by the first point coordinate and the second point coordinate, and a target angle between the target line segment and the reference line;
    从所述样本夹角中,筛选出与所述目标夹角差距最小的样本夹角;From the angle of the sample, the angle between the samples having the smallest angle with the target is selected;
    将所述目标长度与筛选出的样本夹角所对应的样本长度相比,获得待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例。Comparing the target length with the sample length corresponding to the selected sample angle, obtaining a first scaling ratio of the bottom surface contour of the solid image to be drawn relative to the bottom surface contour of the standard solid image.
  6. 根据权利要求3所述的方法,其特征在于,所述预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系还包括:绘制所述标准立体图形中底面轮廓所需的绘制信息;若所述标准三维体为圆柱体或圆锥体,所述绘制信息包括所述标准立体图形中底面轮廓的最长半径以及最短半径的长度和延伸方向;若所述标准三维体为两底面平行且两底面为相同正多边形的柱体,所述绘制信息包括所述标准立体图形中底面轮廓的中心点到各顶点的长度和方向;The method according to claim 3, wherein the relationship between each specified contour point and the center point on the bottom surface contour of the preset standard solid figure further comprises: drawing required to draw the bottom surface contour in the standard solid figure Information; if the standard three-dimensional body is a cylinder or a cone, the drawing information includes a longest radius of the bottom surface contour and a length and an extension direction of the shortest radius in the standard solid figure; if the standard three-dimensional body is two bottom surfaces Parallel and two bottom surfaces are cylinders of the same regular polygon, and the drawing information includes a length from a center point of the bottom surface contour of the standard solid figure to each vertex;
    所述基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓,包括:The drawing the bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio includes:
    基于所述第一缩放比例对所述绘制信息中的长度进行缩放;Scaling the length in the rendering information based on the first scaling ratio;
    利用缩放获得的长度以及绘制信息中的方向,绘制所述待绘制立体图形的底面轮廓。The bottom surface contour of the stereoscopic graphic to be drawn is drawn by the length obtained by the scaling and the direction in the drawing information.
  7. 根据权利要求2所述的方法,其特征在于,若所述标准三维体为圆柱体或两底面平行且两底面为相同正多边形的柱体,所述标准立体图形中侧面轮廓的延伸方向的确定步骤包括:The method according to claim 2, wherein if the standard three-dimensional body is a cylinder or a cylinder whose two bottom surfaces are parallel and the two bottom surfaces are the same regular polygon, the extending direction of the side contour in the standard three-dimensional figure is determined. The steps include:
    基于所述标准立体图形的上底面轮廓中指定轮廓点的坐标、以及下底面轮廓中指定轮廓点的坐标,确定标准立体图形中侧面轮廓的延伸方向;Determining an extension direction of the side contour in the standard solid figure based on coordinates of the specified contour point in the upper bottom surface contour of the standard solid figure and coordinates of the specified contour point in the lower bottom surface contour;
    若所述标准三维体为圆锥体,所述标准立体图形中侧面轮廓的延伸方向的确定步骤包括:If the standard three-dimensional body is a cone, the determining step of the extending direction of the side profile in the standard three-dimensional figure includes:
    基于所述标准立体图形中底面轮廓中指定轮廓点的坐标、以及所述标准立体图形的顶点坐标,确定标准立体图形中轮廓母线的延伸方向。Determining the extending direction of the contour bus bar in the standard solid figure based on the coordinates of the specified contour point in the bottom surface contour in the standard solid figure and the vertex coordinates of the standard solid figure.
  8. 根据权利要求1至7任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 7, wherein the method further comprises:
    根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的长度和延伸方向,确定待绘制立体图形的侧面轮廓相对于标准立体图形的侧面轮廓的第二缩放比例;Determining, according to the distance between the second point coordinate and the third point coordinate, and the length and the extending direction of the side contour in the standard solid figure, a second scaling ratio of the side contour of the solid figure to be drawn relative to the side contour of the standard solid figure;
    获取利用三维绘图引擎绘制所述标准立体图形时所需的三维参数;Obtaining three-dimensional parameters required to draw the standard solid figure using a three-dimensional drawing engine;
    基于所述第一缩放比例和所述第二缩放比例,对所述三维参数进行缩放;And scaling the three-dimensional parameter based on the first scaling ratio and the second scaling ratio;
    将缩放获得的三维参数输入三维绘图引擎。Enter the 3D parameters obtained by scaling into the 3D drawing engine.
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:The method of claim 8 further comprising:
    基于所述三维绘图引擎,利用缩放获得的三维参数绘制所述待绘制立体图形;And drawing, according to the three-dimensional drawing engine, the three-dimensional parameters obtained by the scaling, the three-dimensional graphics to be drawn;
    接收对所述待绘制立体图形的旋转操作指令;Receiving a rotation operation instruction for the stereoscopic graphic to be drawn;
    根据所述旋转操作指令变换所述待绘制立体图形所对应的三维体的显示视角;Converting a display angle of view of the three-dimensional body corresponding to the stereoscopic graphic to be drawn according to the rotation operation instruction;
    绘制所述三维体在该显示视角下的立体图形。A three-dimensional figure of the three-dimensional body at the display viewing angle is drawn.
  10. 一种立体图形绘制装置,其特征在于,所述装置包括: A stereoscopic graphics drawing device, characterized in that the device comprises:
    坐标获取模块,用于获取第一点坐标、第二点坐标、第三点坐标;a coordinate acquiring module, configured to acquire a first point coordinate, a second point coordinate, and a third point coordinate;
    比例确定模块,用于将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;a ratio determining module, configured to respectively use the first point coordinate and the second point coordinate as a center point coordinate and a contour point coordinate of a bottom surface contour in the stereoscopic graphic to be drawn, and combined with each of the preset bottom surface contours of the standard three-dimensional graphic a relationship between the contour point and the center point, determining a first scaling ratio of the bottom surface contour of the solid graphics to be drawn relative to the bottom surface contour of the standard solid graphics;
    图形绘制模块,用于基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。a graphic drawing module, configured to draw a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio; a distance according to the second point coordinate and the third point coordinate, and an extending direction of the side contour in the standard solid graphic, Draw the outline of the other faces in the perspective view to be drawn.
  11. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
    其中,所述处理器被配置为:Wherein the processor is configured to:
    获取第一点坐标、第二点坐标、第三点坐标;Obtaining a first point coordinate, a second point coordinate, and a third point coordinate;
    将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
    基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio;
    根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
  12. 根据权利要求11所述的电子设备,其特征在于,所述电子设备为智能平板。The electronic device according to claim 11, wherein the electronic device is a smart tablet.
  13. 一种计算机存储介质,其特征在于,所述存储介质中存储有程序指令,所述程序指令包括:A computer storage medium, wherein the storage medium stores program instructions, and the program instructions include:
    获取第一点坐标、第二点坐标、第三点坐标;Obtaining a first point coordinate, a second point coordinate, and a third point coordinate;
    将所述第一点坐标和第二点坐标分别作为待绘制立体图形中底面轮廓的中心点坐标和轮廓点坐标,并结合预设的标准立体图形的底面轮廓上各指定轮廓点与中心点的关系,确定待绘制立体图形的底面轮廓相对于标准立体图形的底面轮廓的第一缩放比例;Taking the first point coordinate and the second point coordinate as the center point coordinate and the contour point coordinate of the bottom surface contour in the solid figure to be drawn, respectively, and combining the specified contour point and the center point on the bottom surface contour of the preset standard three-dimensional figure a relationship determining a first scaling ratio of a bottom surface contour of the solid graphics to be drawn with respect to a bottom surface contour of the standard solid graphics;
    基于所述第一缩放比例绘制所述待绘制立体图形的底面轮廓;Drawing a bottom surface contour of the stereoscopic graphic to be drawn based on the first scaling ratio;
    根据第二点坐标和第三点坐标的距离、以及所述标准立体图形中侧面轮廓的延伸方向,绘制所示待绘制立体图中其他面的轮廓。 The contours of the other faces in the stereogram to be drawn are drawn according to the distance between the second point coordinate and the third point coordinate, and the extending direction of the side contour in the standard solid figure.
PCT/CN2017/104816 2017-06-27 2017-09-30 Three-dimensional graphic rendering method, apparatus, device, and storage medium WO2019000692A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710501302.0A CN107248192A (en) 2017-06-27 2017-06-27 Solid figure method for drafting, device, equipment and storage medium
CN201710501302.0 2017-06-27

Publications (1)

Publication Number Publication Date
WO2019000692A1 true WO2019000692A1 (en) 2019-01-03

Family

ID=60013694

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/104816 WO2019000692A1 (en) 2017-06-27 2017-09-30 Three-dimensional graphic rendering method, apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN107248192A (en)
WO (1) WO2019000692A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109785434A (en) * 2017-11-14 2019-05-21 上海谦问万答吧云计算科技有限公司 A kind of method, apparatus and storage medium of drawing three-dimensional solid figure
CN110647236A (en) * 2018-06-27 2020-01-03 深圳市掌网科技股份有限公司 Virtual brush and drawing method
CN109933264B (en) * 2019-03-19 2022-01-04 深圳市元征科技股份有限公司 Graphic data display method and device
CN109976614B (en) * 2019-03-28 2021-04-06 广州视源电子科技股份有限公司 Method, device, equipment and medium for marking three-dimensional graph
CN110489693A (en) * 2019-07-23 2019-11-22 北京字节跳动网络技术有限公司 A kind of method, apparatus of drawing 3 D graphics, medium and electronic equipment
CN110378841A (en) * 2019-07-24 2019-10-25 百度在线网络技术(北京)有限公司 Display processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120271369A1 (en) * 2010-05-05 2012-10-25 Sorin Crm S.A.S. Endocardial stimulation/defibrillation system of the left ventricle
CN104154452A (en) * 2014-08-26 2014-11-19 区其富 LED bulb
CN104238921A (en) * 2013-06-21 2014-12-24 苏州精易会信息技术有限公司 Custom polygon drawing method and device
CN105809734A (en) * 2016-03-10 2016-07-27 杭州师范大学 Mechanical model 3D modeling method based on multiple view interaction

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100349189C (en) * 2005-10-26 2007-11-14 浙江大学 Sparse grid-oriented three-dimensional foot type fast acquiring method based on standard foot deformation
CN104915986B (en) * 2015-06-26 2018-04-17 北京航空航天大学 A kind of solid threedimensional model method for automatic modeling
CN105069226B (en) * 2015-08-03 2018-05-08 常州赞云软件科技有限公司 A kind of three-dimensional modeling modeling method based on template
CN106003025A (en) * 2016-05-31 2016-10-12 上海未来伙伴机器人有限公司 Method and device for creating three-dimensional robot model

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120271369A1 (en) * 2010-05-05 2012-10-25 Sorin Crm S.A.S. Endocardial stimulation/defibrillation system of the left ventricle
CN104238921A (en) * 2013-06-21 2014-12-24 苏州精易会信息技术有限公司 Custom polygon drawing method and device
CN104154452A (en) * 2014-08-26 2014-11-19 区其富 LED bulb
CN105809734A (en) * 2016-03-10 2016-07-27 杭州师范大学 Mechanical model 3D modeling method based on multiple view interaction

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"102977613", 25 August 2010 (2010-08-25), pages 1 - 25, Retrieved from the Internet <URL:https://wenku.baidu.com/view/b10d0e94dd88d0d233d46ae3.html> *

Also Published As

Publication number Publication date
CN107248192A (en) 2017-10-13

Similar Documents

Publication Publication Date Title
WO2019000692A1 (en) Three-dimensional graphic rendering method, apparatus, device, and storage medium
WO2018205493A1 (en) Graphic drawing method, apparatus and device
US9437045B2 (en) Real-time mobile capture and application of photographic images as textures in three-dimensional models
CN106997613B (en) 3D model generation from 2D images
KR20120009564A (en) Apparatus and method for generating 3 dimentional mouse pointer
US10649615B2 (en) Control interface for a three-dimensional graphical object
CN112100795B (en) Computer aided design drawing comparison method and device
US20140225894A1 (en) 3d-rendering method and device for logical window
US11651556B2 (en) Virtual exhibition space providing method for efficient data management
US11250643B2 (en) Method of providing virtual exhibition space using 2.5-dimensionalization
CN116109765A (en) Three-dimensional rendering method and device for labeling objects, computer equipment and storage medium
TW201503050A (en) Three dimensional data visualization
WO2021167586A1 (en) Systems and methods for object detection including pose and size estimation
CN113129362B (en) Method and device for acquiring three-dimensional coordinate data
US20200118313A1 (en) Identification and modification of similar objects in vector images
CN113538623A (en) Method and device for determining target image, electronic equipment and storage medium
JP6564259B2 (en) Image processing apparatus and image processing method
TW202026861A (en) Authoring device, authoring method, and authoring program
US20210278954A1 (en) Projecting inputs to three-dimensional object representations
JP2020013390A (en) Information processing apparatus, information processing program, and information processing method
US20230215033A1 (en) Convex geometry image capture
US11132836B2 (en) Method for determining real world measurements from an apparel 3D model
CN115239910A (en) Data measurement method based on three-dimensional grid model and related equipment
US10134158B2 (en) Directional stamping
JP2006171889A (en) Three-dimensional shape display system, three-dimensional shape display method and three-dimensional shape display program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17915253

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28.04.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17915253

Country of ref document: EP

Kind code of ref document: A1