WO2018205493A1 - Graphic drawing method, apparatus and device - Google Patents

Graphic drawing method, apparatus and device Download PDF

Info

Publication number
WO2018205493A1
WO2018205493A1 PCT/CN2017/104850 CN2017104850W WO2018205493A1 WO 2018205493 A1 WO2018205493 A1 WO 2018205493A1 CN 2017104850 W CN2017104850 W CN 2017104850W WO 2018205493 A1 WO2018205493 A1 WO 2018205493A1
Authority
WO
WIPO (PCT)
Prior art keywords
angle
preset
dimensional
point
cuboid
Prior art date
Application number
PCT/CN2017/104850
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 WO2018205493A1 publication Critical patent/WO2018205493A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/12Bounding box

Definitions

  • the present invention relates to the field of graphics technology, and in particular, to a graphics rendering method, apparatus, and device.
  • the rectangular parallelepiped is a straight prism with a rectangular bottom surface.
  • a cube also called a cube
  • a cube is a rectangular parallelepiped with six faces being square.
  • a rectangular parallelepiped graphic is a graphic used to represent a rectangular parallelepiped in a two-dimensional plane.
  • the rectangular parallelepiped graphic may be a graphic formed by projecting a rectangular parallelepiped onto a two-dimensional plane according to a specified projection relationship, and the same rectangular parallelepiped may be different in projection onto a two-dimensional plane according to different projection relationships.
  • FIG. 1 is a schematic diagram of drawing a rectangular parallelepiped figure by a two-point method in the related art.
  • two coordinate points are determined on the screen: P1 and P2, the two coordinate points are used as diagonal vertices, and the other two vertex coordinates are determined based on the preset rule, and the size of the rectangular figure to be drawn is obtained.
  • the above method has poor response to the operation instruction, and the rectangular parallelepiped figure drawn according to the operation instruction has a gap with the rectangular parallelepiped figure that the user expects to draw, resulting in low accuracy of the drawn rectangular parallelepiped figure.
  • the present invention provides a method, device and device for drawing graphics.
  • a graphics rendering method comprising:
  • Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the first a second angle is a target surface of the rectangular parallelepiped pattern, wherein the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped image, and the first angle is the preset surface The angle between an edge and an axis of a preset two-dimensional coordinate system in a two-dimensional plane;
  • the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and the preset drawing direction are obtained according to the specified projection relationship.
  • the specified projection relationship includes a placement angle of the standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
  • the steps of obtaining the first angle, the second angle, and the preset drawing direction include:
  • the angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
  • the drawing the target angle of the rectangular parallelepiped figure by combining the preset first angle and the second angle comprises:
  • the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
  • the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system are transformed into a new two-dimensional coordinate system to obtain a new two-dimensional coordinate system.
  • the target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
  • the method further includes:
  • the length, width, and height of the rectangular parallelepiped corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input to the three-dimensional drawing engine.
  • a graphics rendering apparatus comprising:
  • a coordinate acquiring module configured to acquire a first point coordinate; acquire a second point coordinate; and acquire a third point coordinate;
  • a graphic drawing module configured to use the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and draw a target surface of the rectangular parallelepiped figure according to the preset first angle and the second angle, based on Depicting the second point coordinate, the third point coordinate, and the preset drawing direction, and drawing other faces of the rectangular parallelepiped graphic;
  • the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped
  • the first angle is one of the preset surface and the two-dimensional plane
  • An angle of one axis of the two-dimensional coordinate system is set, and the preset drawing direction is a direction of an edge of the standard rectangular parallelepiped that is connected to the preset surface.
  • the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and the preset drawing direction are obtained according to the specified projection relationship.
  • the specified projection relationship includes a placement angle of the standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
  • the device further includes a parameter determining module, configured to:
  • the angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
  • the device further includes:
  • a three-dimensional size determining module configured to determine a length, a width, and a height of the standard cuboid, respectively corresponding to a length, a width, and a height of the standard cuboid figure; determining the cuboid according to coordinates of each vertex in the cuboid figure Length, width, and height of the graphic; determining the length, width, and height of the rectangular parallelepiped corresponding to the rectangular parallelepiped figure by using the correspondence relationship and the length, width, and height of the rectangular parallelepiped graphic;
  • An information transmission module for inputting the determined length, width, and height into the three-dimensional drawing engine.
  • an electronic device including:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
  • one side of the rectangular parallelepiped graphic is drawn by two points, and the other five faces of the rectangular parallelepiped graphic are drawn by the third point, thereby realizing the drawing of the rectangular parallelepiped graphic, because the user can control the length of the rectangular parallelepiped figure through two points.
  • the height of the cuboid graphic is controlled by the third point, so the drawing instruction can be accurately responded, and the rectangular parallelepiped figure that the user desires to draw can be drawn, thereby improving the accuracy of drawing the rectangular parallelepiped figure.
  • FIG. 1 is a schematic diagram of drawing a rectangular parallelepiped figure using a two-point method in the related art.
  • FIG. 2A is a flow chart of a graphics rendering method according to an exemplary embodiment of the present invention.
  • FIG. 2B is a schematic diagram of drawing a diagram according to an exemplary embodiment of the present invention.
  • 2C is a schematic diagram of a sample data set according to an exemplary embodiment of the present invention.
  • FIG. 2D is a schematic diagram of determining diagonal vertex coordinates according to an exemplary embodiment of the present invention.
  • FIG. 2E is a schematic diagram showing another drawing of the present invention according to an exemplary embodiment.
  • FIG. 2F is another schematic diagram of drawing according to an exemplary embodiment of the present invention.
  • FIG. 3 is a flow chart of another method of drawing graphics according to an exemplary embodiment of the present invention.
  • FIG. 4 is a block diagram of a graphics rendering apparatus according to an exemplary embodiment of the present invention.
  • FIG. 5 is a block diagram of an apparatus for graphics rendering, in accordance with 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 a determination.”
  • the P1 point and the P2 point are determined on the screen according to the user operation instruction, the two coordinate points are used as a pair of diagonal vertices, and the other two vertex coordinates P3 and P4 are determined based on the preset rule.
  • a rectangle P1P4P2P3 for defining the size of the cuboid pattern to be drawn is obtained.
  • a rectangular parallelepiped figure is inversely pushed according to the determined rectangle, and the six vertices of the rectangular parallelepiped figure are on the side of the rectangle P1P4P2P3, thereby realizing the drawing of the rectangular parallelepiped figure.
  • the user when the user specifies the P1 and P2 points, the user can see the cuboid figure drawn by the drawing, and the user can not draw the desired cuboid figure by controlling the two points very well, that is, the cuboid figure and the user drawn by the two-point method. It is expected that the drawn rectangular parallelepiped pattern has a gap, resulting in a low accuracy of the drawn rectangular parallelepiped pattern. When the gap is large, the user needs to delete and then re-draw, resulting in low drawing efficiency.
  • the present invention provides a graphic drawing method. You can draw a face of the cuboid figure through two points and draw the other five faces of the cuboid figure through the third point to realize the drawing of the cuboid figure. Since the user can control the length and width of the cuboid figure through two points, pass the third The point controls the height of the cuboid graphic, so it can actively respond to the drawing instruction, draw the rectangular parallelepiped figure that the user desires to draw, and thereby improve the accuracy of drawing the rectangular parallelepiped figure.
  • the solution of the present invention will be described in detail.
  • the embodiment of the present invention can be applied to a smart device, and the smart device can be a smart whiteboard, 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 the finger or the stylus pen to draw the graphic on the touch screen of the smart device, or use the mouse to control the cursor on the screen of the smart device for graphic drawing, and the smart device can receive the drawing instruction generated by the user operation, and according to the drawing instruction. Determine the three-point coordinates and then draw the graph.
  • FIG. 2A is a flowchart of a graphic drawing method according to an exemplary embodiment of the present invention, which includes the following steps 201 to 204:
  • step 201 the first point coordinates are acquired; the second point coordinates are acquired;
  • step 202 the first point coordinate and the second point coordinate are used as coordinates of a pair of diagonal vertices, and the target face of the rectangular parallelepiped figure is drawn in combination with the preset first angle and the second angle, the first The two angles are the angles of two adjacent sides in the preset surface in the preset standard rectangular parallelepiped, and the first angle is a preset two-dimensional coordinate system in one of the preset surfaces and the two-dimensional plane The angle of one axis;
  • step 203 acquiring third point coordinates
  • step 204 other faces of the cuboid figure are drawn based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is in the standard cuboid figure and Set the direction of the edges of the faces.
  • the three point coordinates are determined by the click position corresponding to the click command.
  • the click command may be a mouse click command, a finger click command, or a touch pen click command.
  • 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 further provides another implementation manner, which can dynamically adjust the second point coordinate to dynamically adjust the length and width of the rectangular figure, and when receiving the second confirmation command The coordinates at this time are taken as the final second point coordinates to achieve the final confirmation of the length and width.
  • the third point coordinate can be dynamically adjusted to dynamically adjust the height in the cuboid image.
  • a rectangular parallelepiped 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 target surface is drawn.
  • the coordinate of the second point changes continuously, the target surface also changes.
  • the coordinates of the second point the target surface desired by the user can be drawn.
  • the coordinates at this time are taken as the final second point coordinates to achieve the final confirmation of the length and width.
  • the second confirmation command may be a mouse click command, a finger/touch pen click command, or a press command.
  • the second point is used as the starting point for sliding, and any point in the sliding track can be used as the third point.
  • the other five faces are drawn.
  • the coordinate of the third point changes continuously, the other five faces also change.
  • the user's desired height can be drawn, thereby Obtain the desired cuboid graphic.
  • FIG. 2B is a schematic diagram showing a drawing of the present invention according to an exemplary embodiment.
  • the target faces are redrawn, and the other five faces are redrawn each time the coordinates of the third point are changed.
  • a dynamic effect of stretching the target surface in the preset drawing direction according to the distance between the second point and the third point can be presented.
  • FIG. 2B only exemplifies five 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 target surface is drawn, and FIG. 2B is exemplified by taking the P2' point in the drag track as an example, and the target surface 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 target surface is drawn to be obtained, as shown by state three in FIG.
  • FIG. 2B is dragged in the track.
  • the P3' point is exemplified as an example, and a rectangular parallelepiped chart as shown in state four in Fig. 2B is obtained according to the target plane and the P3' point drawing shown in the state three.
  • the point is determined as the final third point, and the final cuboid figure is drawn. As shown in state 5 in Figure 2B.
  • the first angle, the second angle, and the preset drawing direction are introduced.
  • the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped image
  • the first angle is an axis of the preset surface and an axis of the preset two-dimensional coordinate system in the two-dimensional plane
  • the angle of the preset drawing is the direction of the edge of the standard cuboid image connected to the preset surface.
  • the preset surface is one side of the standard rectangular parallelepiped image, for example, it may be any one of the top surface, the bottom surface, and the side surface in the standard rectangular parallelepiped image. In order to adapt to the user's drawing habits, the preset surface is the top surface in the standard cuboid image.
  • the direction of the rib is the direction of the line where the rib is located.
  • the first angle, the second angle, and the preset drawing direction in the standard rectangular parallelepiped drawing it is desirable to realize the angle between an adjacent side of the target plane of the drawn rectangular parallelepiped figure as the second clip.
  • the angle between the edge of the target surface and the axis of the preset two-dimensional coordinate system in the two-dimensional plane is the first angle
  • the direction of the edge adjacent to the target surface in the rectangular parallelepiped pattern is the preset drawing direction.
  • FIG. 2C is a schematic diagram of a sample data set according to an exemplary embodiment of the present invention.
  • the sample data set includes a first angle, a second angle, and a preset drawing direction.
  • the vertex O in the standard cuboid map coincides with the origin in the two-dimensional coordinate system
  • the angle ⁇ between OC and OX is the first angle
  • the angle ⁇ between AO and AB is the second angle
  • BD The two directions of the line are the preset drawing directions.
  • the standard rectangular parallelepiped may be drawn. Cuboid graphics.
  • the rectangular parallelepiped graphic is a graphic drawn on a two-dimensional plane.
  • a graphic formed by projecting a rectangular parallelepiped onto a two-dimensional plane according to a specified projection relationship may be used as a rectangular parallelepiped graphic.
  • the standard cuboid map is a projection graph that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and the preset drawing direction are based on the Specifies the projection relationship to get.
  • the preset drawing direction includes the placement angle of the rectangular parallelepiped, the distance between the rectangular parallelepiped and the projection device, the projection direction, and the projection manner.
  • 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 standard rectangular parallelepiped can be drawn.
  • the rectangular parallelepiped graphics with the same projection relationship, the length, width and height of the rectangular parallelepiped graphics are based on the first point coordinates, the second point coordinates, and the third point coordinates. Change to improve the authenticity of the rectangular figure. Among them, the length, width and height of the rectangular figure are the lengths of three different sides in the two-dimensional figure.
  • At least one sample data group of the projection relationship may be pre-stored, and the sample data group includes a first angle, a second angle, and a preset drawing direction in the same projection relationship.
  • a sample data set of a projection relationship is fixedly stored, and each time the graphic is drawn, the parameters in the sample data set are used for drawing.
  • a sample data set corresponding to multiple projection relationships may be stored. Determine the sample data set before drawing the box. For example, based on the projection relationship setting interface, receiving a projection relationship setting instruction, determining a projection relationship according to the projection relationship setting instruction, thereby determining a corresponding sample data group, and then performing a rectangular parallelepiped graphic drawing according to the determined sample data group.
  • the projection relationship can be directly described by text, or the standard rectangular parallelepiped corresponding to each projection relationship can be prompted, so that the user can view the display effect of each projection relationship, thereby quickly setting the projection relationship.
  • the embodiment of the invention further provides a method for generating a first angle, a second angle and a preset drawing direction, the method comprising the following steps:
  • the angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
  • the standard cuboid is a pre-set cuboid used as a reference.
  • the three-dimensional coordinates of the vertices of the standard cuboid in the three-dimensional coordinate system under the specified projection relationship can be obtained by keeping the placement angle of the standard cuboid, the distance between the standard cuboid and the projection device, the projection direction, and the projection mode.
  • the coordinate of X can be taken as (1, 0).
  • a direction of an edge of the standard cuboid connected to the surface is determined as the preset drawing direction, for example, a direction of a line where the BD is located is determined as a preset drawing direction, and the preset drawing direction may include a vector.
  • Direction and vector The direction.
  • the graphic drawing can be performed.
  • the first point coordinate and the second point coordinate are used as coordinates of a pair of diagonal vertices, and the target surface of the rectangular parallelepiped graphic is drawn in combination with the preset first angle and the second angle, including:
  • the target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
  • the angle between an edge of the target surface and the axis of the preset two-dimensional coordinate system is the first angle
  • the angle between two adjacent edges of the target surface is the second clamp. angle.
  • the angle between one edge of the target surface and one axis in the two-dimensional coordinate system, the angle between adjacent edges in the target surface, and the two vertices in the target surface can obtain the target according to the triangular relationship.
  • the coordinates of another pair of diagonal vertices in the face is known to obtain the target according to the triangular relationship.
  • the combination of the preset first angle and the second angle determine coordinates of another pair of diagonal vertices, including:
  • the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
  • the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system are transformed into a new two-dimensional coordinate system to obtain a new two-dimensional coordinate system.
  • the preset two-dimensional coordinate system may be referred to as a original two-dimensional coordinate system
  • the new two-dimensional coordinate system may be a pre-established two-dimensional coordinate system, or may be a two-dimensional coordinate system established when receiving a drawing instruction.
  • the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is the first angle, so that one of the axes of the new two-dimensional coordinate system is on the same line as one edge of the target surface. Up, thereby improving the efficiency of determining the coordinates of another pair of diagonal vertices.
  • the angle between the corresponding axes is the first angle, that is, the angle between the X-axis of the new two-dimensional coordinate system and the X-axis of the preset two-dimensional coordinate system is the first angle, and the new two-dimensional coordinate system Y-axis and the preset two-dimensional The angle between the Y-axis of the coordinate system is the first angle. It can be understood that if the first angle is zero, it is not necessary to establish a new two-dimensional coordinate system.
  • the mapping relationship between the coordinate system x'oy' and xoy can be calculated according to the alpha value, as follows:
  • the transformation matrix of the coordinate system xoy to the coordinate system x'oy' is:
  • the transformation matrix of the coordinate system x'oy' to the coordinate system xoy is:
  • the first point coordinate and the second point coordinate can be transformed into a new two-dimensional coordinate system to obtain the first point new coordinate and the new two-dimensional coordinate system.
  • the second point is a new coordinate, and the coordinates of the other pair of diagonal vertices in the new two-dimensional coordinate system are determined according to the first point new coordinate, the second point new coordinate, and the preset second angle.
  • the two pairs of diagonal vertices may be based on the new two The coordinates in the dimension coordinate system draw the target surface.
  • the coordinates of another pair of diagonal vertices obtained may be transformed into a preset two-dimensional coordinate system based on a transformation matrix of the new two-dimensional coordinate system to a preset two-dimensional coordinate system, and another pair is obtained.
  • the coordinates of the angular vertices in the preset two-dimensional coordinate system, and the target surface is drawn based on the coordinates of the two pairs of diagonal vertices in the preset two-dimensional coordinate system.
  • FIG. 2D is a schematic diagram of determining diagonal vertex coordinates according to an exemplary embodiment of the present invention.
  • a preset two-dimensional coordinate system xoy, a new two-dimensional coordinate system x'oy', and a target surface A'OC'B' are included.
  • the new two-dimensional coordinate system x'oy' is the same as the origin of the preset two-dimensional coordinate system xoy, and the X-axis of the new two-dimensional coordinate system x'oy' is the same as the OC' edge of the target surface A'OC'B'
  • the first point coordinate P1 and the second point coordinate P2 are taken as coordinates of a pair of diagonal vertices O and B'. Further, in order to improve the calculation efficiency, the first point coordinate P1 coincides with the origin of the preset two-dimensional coordinate system xoy and the new two-dimensional coordinate system x'oy'.
  • the beta value calculates the coordinates of A' and C' in the x'oy' coordinate system.
  • the coordinates of A' and C' are as follows:
  • P1'.X-(P2'.Y-P1'.Y)*cot ⁇ represents the abscissa of A'
  • P2'.Y represents the ordinate of A'
  • P1'.X+(P2'.X-A' .X) denotes the abscissa of C'
  • P1'.Y denotes the ordinate of C'
  • P1'.X denotes the abscissa of P1
  • P1'.Y denotes the ordinate of P1
  • P2'.X denotes the abscissa of P2
  • P2'.Y represents the ordinate of P2
  • A'.X represents the abscissa of A'. Since the first point new coordinate P1' and the second point new coordinate P2', and ⁇ have been determined, the coordinates of A' and C' can be obtained.
  • the third point coordinate may be acquired, and the other four vertex coordinates are determined based on the second point coordinate, the third point coordinate, and the preset drawing direction, and the other faces of the cuboid figure are drawn according to the obtained coordinates.
  • the preset drawing direction may include two directions of a straight line, and the preset drawing direction may be determined according to the moving direction of the third point relative to the second point. For example, a direction in which the angle between the two directions and the moving direction is less than 90 degrees is selected as the currently required preset drawing direction.
  • the height of the rectangular figure can be determined, and the four vertices in the target direction, the height, and the target surface are calculated according to the preset, and the other four vertices are calculated.
  • the coordinates are drawn, and other faces are drawn according to the obtained vertex coordinates and the coordinates of the four vertices in the target face, thereby obtaining a rectangular parallelepiped chart.
  • FIG. 2B illustrates an example in which the moving direction of P2 to P3 is consistent with the preset drawing direction.
  • FIG. 2E is a schematic diagram showing another drawing according to an exemplary embodiment of the present invention.
  • FIG. 2E illustrates an example in which the moving direction of P2 to P3 is inconsistent with the preset drawing direction.
  • the direction of mouse drag is P1 to P2, P2 to P3.
  • several target faces can be drawn. If a confirmation command is received at point P2, the target surface drawn at this time is taken as the final target surface. Since the preset drawing direction includes the positive direction and the negative direction of the y-axis, and since the moving direction of the mouse is P2 to P3, the angle between the P2P3 and the negative direction of the y-axis is less than 90 degrees, and therefore, the preset drawing direction is the y-axis.
  • the lengths of P2 and D' can be determined according to the distance between P2 and P3, and the coordinates of the other four vertices D', E', F', G' are obtained, and according to the obtained vertex coordinates and the target surface The other coordinates of the vertex coordinates are drawn to obtain a rectangular parallelepiped graphic.
  • a non-rotatable rectangular parallelepiped graphic is often drawn by a two-dimensional drawing engine, for example, by a two-point method; a rectangular parallelepiped graphic can also be drawn by a three-dimensional drawing engine, for example, a user manually inputs a length, a height, and a height of a rectangular parallelepiped, and a three-dimensional drawing.
  • the engine can draw the corresponding cuboid and support the rotation function. 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 rectangular parallelepiped graphic with a fixed projection relationship and therefore cannot be rotated.
  • the three-dimensional drawing engine can draw a rectangular parallelepiped figure under different projection relationships according to the rotation instruction.
  • the length, width, and height of the cuboid graphic drawn by the 3D drawing engine are the lengths of three different sides in the drawing.
  • the two-dimensional drawing engine and the three-dimensional drawing engine are used independently. After the rectangular parallelepiped drawing is drawn by the two-dimensional drawing engine, the three-dimensional drawing engine is used to display the rectangular parallelepiped figure of the actual rectangular parallelepiped corresponding to the rectangular parallelepiped in different projection relationships. 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 an actual size of a rectangular parallelepiped according to a rectangular parallelepiped pattern, the method comprising the following steps:
  • the length, width, and height of the rectangular parallelepiped corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input to the three-dimensional drawing engine.
  • the standard rectangular parallelepiped graphic is a graphic formed by projecting a standard rectangular parallelepiped onto a two-dimensional plane according to a specified projection relationship.
  • the length, width, and height of a standard cuboid are the actual length, width, and height.
  • the length, width, and height of a standard cuboid is the length of three different sides in the graph.
  • the length, width, and height of a standard cuboid pattern formed by projecting a standard cuboid onto a two-dimensional plane in different projection relationships may be different. Therefore, the 3D drawing engine needs to know the actual length, width and height of the standard cuboid to draw standard cuboid graphics in different projection relationships.
  • the length, width, and height of the standard cuboid are known during the generation of the first angle, the second angle, and the preset drawing direction.
  • the vertices of the standard cuboid pattern formed by projecting the standard cuboid onto the two-dimensional plane according to the specified projection relationship have been determined, the length, width, and height of the standard cuboid map can be obtained.
  • the length is OC
  • the width is OA
  • the height is BD.
  • the length, width, and height of the standard cuboid can be determined, respectively, corresponding to the length, width, and height of the standard cuboid.
  • the length, width, and height of the rectangular parallelepiped figure can be determined, for example, the length is OC', the width is OA', the height is B'D', and the correspondence and the rectangular parallelepiped figure are utilized.
  • the length, width, and height of the cuboid are determined by the length, width, and height of the cuboid, and the determined length, width, and height are input into the three-dimensional drawing engine, so that the cuboid graphics under different projection relationships can be drawn by the three-dimensional drawing engine. .
  • the length, width, and height of the standard rectangular parallelepiped are: X 0 , Z 0 , and Y 0
  • the length and width of the standard rectangular parallelepiped pattern formed by projecting the standard rectangular parallelepiped onto the two-dimensional plane according to the specified projection relationship are: OC, OA, and BD.
  • the length, width, and height of the rectangular parallelepiped are: X, Z, and Y
  • the width and height are: OC', OA', B'D', and X, Y, Z can be obtained by the following formula:
  • the size of the actual cuboid corresponding to the cuboid figure can be determined according to the drawn rectangular parallelepiped figure, and then the cuboid figure is drawn by the three-dimensional drawing engine.
  • the two-dimensional drawing engine or the self-made two-dimensional drawing tool can be used to draw the rectangular parallelepiped figure in the two-dimensional plane (ie, step 201 to step 204 are performed), and the cuboid corresponding to the drawn rectangular parallelepiped figure is determined in the three-dimensional drawing engine.
  • Body graphics and support the rotation of the cuboid graphics.
  • FIG. 2F is a schematic diagram showing another drawing according to an exemplary embodiment of the present invention. Since the first point to the final second point, the final second point to the final third point, and the rotation, the displayed figure exhibits a dynamic effect, and for the convenience of illustration, FIG. 2F exemplifies only seven states. During the drawing process, the first point clicked by the user is taken as the first point, and the first point is used as the starting point to move, and any point in the moving track is the second point, and the corresponding second point is dynamically drawn for each current second point.
  • the target surface, FIG. 2F is exemplified by taking one of the points as an example, such as dynamic drawing to obtain the target surface shown in the second state in FIG. 2F.
  • the currently drawn target surface is determined as the final target surface, as shown in state three in FIG. 2F. Then, moving from the second point as a starting point, any point in the moving track is the third point, and the corresponding cuboid figure is dynamically drawn for each current third point, and when the confirmation instruction is received, the currently drawn cuboid is drawn.
  • the graphic is determined as the final cuboid pattern, as shown in the state of Figure 4F in the cuboid pattern.
  • the three-dimensional size of the rectangular parallelepiped corresponding to the cuboid graphic in the three-dimensional drawing engine can be obtained, the three-dimensional size is transmitted to the three-dimensional drawing engine, the new rectangular parallelepiped graphic is drawn by the three-dimensional drawing engine, and the rotation of the rectangular parallelepiped graphic is supported.
  • Figure 2E shows three rotation diagrams, such as state five, state six, and state seven. Since the three-dimensional size of the cuboid in the three-dimensional drawing engine is determined, when the rectangular parallelepiped is rotated, a rectangular parallelepiped figure formed by projecting the rectangular parallelepiped into a two-dimensional plane according to different projection relationships can be displayed.
  • FIG. 3 is a flowchart of another graphic drawing method according to an exemplary embodiment of the present invention, and the method includes the following steps:
  • step 301 the first point coordinates are acquired, and the second point coordinates are acquired.
  • step 302 the first point coordinate and the second point coordinate are used as coordinates of a pair of diagonal vertices, and the coordinates of the other pair of diagonal vertices are determined according to the preset first angle and the second angle. And drawing a target surface of the rectangular parallelepiped figure according to the obtained coordinates, where the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped image, and the first angle is the preset The angle between one edge of the face and one axis of the preset two-dimensional coordinate system in the two-dimensional plane.
  • step 303 the third point coordinates are acquired.
  • step 304 based on the second point coordinates, the third point coordinates, and the preset drawing direction, the other four vertex coordinates in the cuboid figure are obtained, and other faces of the cuboid figure are drawn.
  • step 305 the length, width, and height of the rectangular parallelepiped pattern are determined according to the coordinates of the vertices in the rectangular parallelepiped pattern.
  • step 306 the length, width, and height of the cuboid corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input into a three-dimensional drawing. engine.
  • the correspondence relationship is a relationship between a length of a standard cuboid and a standard cuboid, a relationship between a width of a standard cuboid and a standard cuboid, a relationship between a height of a standard cuboid and a standard cuboid, and the standard cuboid
  • a graph is a graph formed by projecting a standard cuboid onto a two-dimensional plane in a specified projection relationship.
  • the present embodiment draws one face of the rectangular parallelepiped figure by two points, and draws the other five faces of the rectangular parallelepiped figure through the third point, thereby realizing the drawing of the rectangular parallelepiped figure, because the user can control the rectangular parallelepiped figure through two points.
  • the length and width control the height of the cuboid figure through the third point, so the drawing instruction can be actively responded to draw the cuboid figure that the user desires to draw, thereby improving the accuracy of drawing the cuboid figure.
  • the three-dimensional size of the rectangular parallelepiped can be obtained, and the three-dimensional size is transmitted to the three-dimensional drawing engine, and the rectangular parallelepiped graphic under the various projection relationships of the rectangular parallelepiped is drawn by the three-dimensional drawing engine, thereby realizing the two-dimensional drawing tool and the three-dimensional drawing engine. Combine.
  • the present invention also provides a graphics rendering apparatus, an electronic device to which the apparatus is applied, and an embodiment of a computing storage medium.
  • FIG. 4 is a block diagram of a graphics rendering apparatus according to an exemplary embodiment of the present invention, the apparatus includes:
  • the coordinate acquiring module 410 is configured to acquire first coordinate coordinates, acquire second coordinate coordinates, and acquire third coordinate coordinates;
  • a graphic drawing module 420 configured to use the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and draw a target surface of the rectangular parallelepiped figure according to the preset first angle and the second angle, based on Drawing the second point coordinate, the third point coordinate, and the preset drawing direction to draw other faces of the rectangular parallelepiped graphic;
  • the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped
  • the first angle is one of the preset surface and the two-dimensional plane
  • An angle of one axis of the two-dimensional coordinate system is set, and the preset drawing direction is a direction of an edge of the standard rectangular parallelepiped that is connected to the preset surface.
  • the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and a preset drawing direction are based on The specified projection relationship is obtained, and the specified projection relationship includes a placement angle of a standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
  • the apparatus further includes a parameter determining module, configured to:
  • the angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
  • the graphic drawing module 420 is specifically configured to:
  • the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
  • the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system are transformed into a new two-dimensional coordinate system to obtain a new two-dimensional coordinate system.
  • the target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
  • the apparatus further includes:
  • a three-dimensional size determining module configured to determine a length, a width, and a height of the standard cuboid, respectively corresponding to a length, a width, and a height of the standard cuboid figure; determining the cuboid according to coordinates of each vertex in the cuboid figure Length, width, and height of the graphic; determining the length, width, and height of the rectangular parallelepiped corresponding to the rectangular parallelepiped figure by using the correspondence relationship and the length, width, and height of the rectangular parallelepiped graphic;
  • An information transmission module for inputting the determined length, width, and height into the three-dimensional drawing engine.
  • 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 are not creative In the case of action, it can be understood and implemented.
  • 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 second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
  • the embodiment of the present application further provides a computer storage medium, where the storage medium stores program instructions, where the program instructions include:
  • the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
  • the application can 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 includes 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.
  • FIG. 5 is a block diagram of an apparatus 500 for graphics rendering, according to an exemplary embodiment.
  • device 500 can be provided as a computer.
  • apparatus 500 includes a processing component 522 that further includes one or more processors, and memory resources represented by memory 532 for storing instructions executable by processing component 522, such as an application.
  • An application stored in memory 532 can include one or more modules each corresponding to a set of instructions.
  • processing component 522 is configured to execute instructions to perform the graphics rendering method described above.
  • Apparatus 500 can also include a power supply component 526 configured to perform power management of apparatus 500, a wired or wireless network interface 550 configured to connect apparatus 500 to the network, and an input/output (I/O) interface 558.
  • Device 500 can operate based on an operating system stored in memory 532.
  • the apparatus 500 when the instructions in the memory 532 are executed by the processing component 522, the apparatus 500 is enabled to perform a graphics rendering method, including:
  • the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;

Landscapes

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

Abstract

A graphic drawing method, apparatus and device. The method comprises: acquiring a first point coordinate, and acquiring a second point coordinate (201); taking the first point coordinate and the second point coordinate as the coordinates of a pair of diagonal vertices, and combining a pre-set first angle and second angle to draw a target face of a cuboid graphic (202), wherein the second angle is an angle between two adjacent sides in a pre-set face in a pre-set standard cuboid graphic, and the first angle is an angle between a side of the pre-set face and an axis of a pre-set two-dimensional coordinate system in the two-dimensional plane; acquiring a third point coordinate (203); and drawing other faces of the cuboid graphic based on the second point coordinates, the third point coordinate, and a pre-set drawing direction (204), wherein the pre-set drawing direction is a direction of an edge, connected to the pre-set face, of the standard cuboid graphic. A cuboid graphic expected by a user can be drawn accurately in response to a drawing instruction, so as to improve the accuracy of drawing the cuboid graphic.

Description

图形绘制方法、装置及设备Graphic drawing method, device and device 技术领域Technical field
本发明涉及绘图技术领域,尤其涉及图形绘制方法、装置及设备。The present invention relates to the field of graphics technology, and in particular, to a graphics rendering method, apparatus, and device.
背景技术Background technique
目前,在教学、绘图等场景中,往往会涉及绘制长方体图形。长方体是底面为长方形的直棱柱。正方体(又可以称为立方体)是特殊的长方体,正方体是六个面都是正方形的长方体。长方体图形是二维平面中用于表示长方体的图形。例如,长方体图形可以是将长方体按指定投影关系投影到二维平面上所形成的图形,同一个长方体,按不同投影关系投影到二维平面上形成的图形可能不同。以教学为例,在教学过程中,老师需向学生展示长方体图形,则可以利用绘图软件进行图形绘制。在绘图软件中可以预存有长方体样本,根据用户操作指令从绘图软件的工具栏中拖出长方体样本并进行位置和大小调整,即可获得长方体图形。又如,可以采用两点法绘制长方体图形,如图1所示,图1是相关技术中利用两点法绘制长方体图形的示意图。根据用户操作指令在屏幕中确定两个坐标点:P1和P2,将两个坐标点作为对角顶点,并基于预设规则,确定其他两个顶点坐标,获得用于限定待绘制长方体图形大小的矩形P1P4P2P3。根据所确定的矩形反推一个长方体图形,长方体图形在矩形P1P4P2P3内,从而实现长方体图形的绘制,At present, in teaching, drawing and other scenes, it is often involved in drawing a rectangular parallelepiped graphic. The rectangular parallelepiped is a straight prism with a rectangular bottom surface. A cube (also called a cube) is a special cuboid, and a cube is a rectangular parallelepiped with six faces being square. A rectangular parallelepiped graphic is a graphic used to represent a rectangular parallelepiped in a two-dimensional plane. For example, the rectangular parallelepiped graphic may be a graphic formed by projecting a rectangular parallelepiped onto a two-dimensional plane according to a specified projection relationship, and the same rectangular parallelepiped may be different in projection onto a two-dimensional plane according to different projection relationships. Taking teaching as an example, in the teaching process, the teacher needs to display the rectangular figure to the students, and then the drawing software can be used for graphic drawing. In the drawing software, a rectangular parallelepiped sample can be pre-stored, and a rectangular parallelepiped pattern can be obtained by dragging a rectangular parallelepiped sample from the toolbar of the drawing software according to a user operation instruction and performing position and size adjustment. For another example, a two-point method can be used to draw a rectangular parallelepiped figure, as shown in FIG. 1. FIG. 1 is a schematic diagram of drawing a rectangular parallelepiped figure by a two-point method in the related art. According to the user operation instruction, two coordinate points are determined on the screen: P1 and P2, the two coordinate points are used as diagonal vertices, and the other two vertex coordinates are determined based on the preset rule, and the size of the rectangular figure to be drawn is obtained. Rectangular P1P4P2P3. Pushing a rectangular parallelepiped figure according to the determined rectangle, the rectangular parallelepiped figure is in the rectangle P1P4P2P3, thereby realizing the drawing of the rectangular parallelepiped figure,
可见,上述方法对操作指令的响应效果差,根据操作指令绘制出的长方体图形与用户预期绘制出的长方体图形具有差距,导致绘制出的长方体图形准确度低。It can be seen that the above method has poor response to the operation instruction, and the rectangular parallelepiped figure drawn according to the operation instruction has a gap with the rectangular parallelepiped figure that the user expects to draw, resulting in low accuracy of the drawn rectangular parallelepiped figure.
发明内容Summary of the invention
基于此,本发明提供了图形绘制方法、装置及设备。Based on this, the present invention provides a method, device and device for drawing graphics.
根据本发明实施例的第一方面,提供一种图形绘制方法,所述方法包括:According to a first aspect of the embodiments of the present invention, a graphics rendering method is provided, the method comprising:
获取第一点坐标;获取第二点坐标;获取第三点坐标;Obtaining the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第 二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the first a second angle is a target surface of the rectangular parallelepiped pattern, wherein the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped image, and the first angle is the preset surface The angle between an edge and an axis of a preset two-dimensional coordinate system in a two-dimensional plane;
基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
可选的,所述标准长方体图是将标准长方体按照指定投影关系投影到二维平面上的投影图形,所述第一夹角、第二夹角以及预设绘制方向基于所述指定投影关系获得,所述指定投影关系包括标准长方体的放置角度、标准长方体与投影设备的距离、投影方向以及投影方式。Optionally, the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and the preset drawing direction are obtained according to the specified projection relationship. The specified projection relationship includes a placement angle of the standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
可选的,获得所述第一夹角、第二夹角以及预设绘制方向的步骤包括:Optionally, the steps of obtaining the first angle, the second angle, and the preset drawing direction include:
在按照指定投影关系将标准长方体从三维空间投影到二维平面时,获取所述标准长方体各顶点的三维坐标;Obtaining three-dimensional coordinates of each vertex of the standard cuboid when projecting a standard cuboid from a three-dimensional space to a two-dimensional plane according to a specified projection relationship;
基于所述指定投影关系下三维空间到二维平面的投影矩阵,将各顶点的三维坐标转换为相应顶点在预设二维坐标系上的二维坐标,根据所述二维坐标确定二维平面中的标准长方体图;And transforming the three-dimensional coordinates of each vertex into two-dimensional coordinates of the corresponding vertex on a preset two-dimensional coordinate system according to the projection matrix of the three-dimensional space to the two-dimensional plane in the specified projection relationship, and determining the two-dimensional plane according to the two-dimensional coordinates Standard cuboid in the middle;
将所述标准长方体图中预设面的一条边,与所述预设二维坐标系中一轴的夹角确定为第一夹角,将所述预设面中两条相邻边的夹角确定为第二夹角,以及将所述标准长方体图中与所述预设面相连的棱的方向确定为所述预设绘制方向。Determining an edge of the preset surface in the standard cuboid image with an axis of the predetermined two-dimensional coordinate system as a first angle, and clamping the two adjacent sides of the preset surface The angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
可选的,所述结合预设的第一夹角和第二夹角绘制长方体图形的目标面,包括:Optionally, the drawing the target angle of the rectangular parallelepiped figure by combining the preset first angle and the second angle comprises:
获取新二维坐标系,所述新二维坐标系与所述预设二维坐标系的原点相同、且所述新二维坐标系与所述预设二维坐标系相应轴的夹角为第一夹角;Obtaining a new two-dimensional coordinate system, the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
基于预设二维坐标系到新二维坐标系的变换矩阵,将预设二维坐标系中所述第一点坐标和第二点坐标变换到新二维坐标系,获得新二维坐标系下的第一点新坐标和第二点新坐标;Based on the transformation matrix of the preset two-dimensional coordinate system to the new two-dimensional coordinate system, the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system are transformed into a new two-dimensional coordinate system to obtain a new two-dimensional coordinate system. The first point of the new coordinate and the second point of the new coordinate;
根据所述第一点新坐标、第二点新坐标以及预设的第二夹角,确定另一对对角顶点在新二维坐标系中的坐标;Determining coordinates of another pair of diagonal vertices in a new two-dimensional coordinate system according to the first point new coordinate, the second point new coordinate, and the preset second angle;
根据两对对角顶点的坐标绘制长方体图形的目标面。The target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
可选的,所述方法还包括:Optionally, the method further includes:
确定所述标准长方体的长、宽、高,分别与所述标准长方体图的长、宽、高的对应关系;Determining, according to the length, width, and height of the standard cuboid, the length, width, and height of the standard cuboid;
根据所述长方体图形中各顶点坐标,确定所述长方体图形的长、宽、高; Determining, according to coordinates of each vertex in the rectangular parallelepiped figure, length, width, and height of the rectangular parallelepiped graphic;
利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的长方体的长、宽、高,并将所确定的长、宽、高输入三维绘图引擎。The length, width, and height of the rectangular parallelepiped corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input to the three-dimensional drawing engine.
根据本发明实施例的第二方面,提供一种图形绘制装置,所述装置包括:According to a second aspect of the embodiments of the present invention, a graphics rendering apparatus is provided, the apparatus comprising:
坐标获取模块,用于获取第一点坐标;获取第二点坐标;获取第三点坐标;a coordinate acquiring module, configured to acquire a first point coordinate; acquire a second point coordinate; and acquire a third point coordinate;
图形绘制模块,用于将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面;a graphic drawing module, configured to use the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and draw a target surface of the rectangular parallelepiped figure according to the preset first angle and the second angle, based on Depicting the second point coordinate, the third point coordinate, and the preset drawing direction, and drawing other faces of the rectangular parallelepiped graphic;
其中,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。The second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped, and the first angle is one of the preset surface and the two-dimensional plane An angle of one axis of the two-dimensional coordinate system is set, and the preset drawing direction is a direction of an edge of the standard rectangular parallelepiped that is connected to the preset surface.
可选的,所述标准长方体图是将标准长方体按照指定投影关系投影到二维平面上的投影图形,所述第一夹角、第二夹角以及预设绘制方向基于所述指定投影关系获得,所述指定投影关系包括标准长方体的放置角度、标准长方体与投影设备的距离、投影方向以及投影方式。Optionally, the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and the preset drawing direction are obtained according to the specified projection relationship. The specified projection relationship includes a placement angle of the standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
可选的,所述装置还包括参数确定模块,用于:Optionally, the device further includes a parameter determining module, configured to:
在按照指定投影关系将标准长方体从三维空间投影到二维平面时,获取所述标准长方体各顶点的三维坐标;Obtaining three-dimensional coordinates of each vertex of the standard cuboid when projecting a standard cuboid from a three-dimensional space to a two-dimensional plane according to a specified projection relationship;
基于所述指定投影关系下三维空间到二维平面的投影矩阵,将各顶点的三维坐标转换为相应顶点在预设二维坐标系上的二维坐标,根据所述二维坐标确定二维平面中的标准长方体图;And transforming the three-dimensional coordinates of each vertex into two-dimensional coordinates of the corresponding vertex on a preset two-dimensional coordinate system according to the projection matrix of the three-dimensional space to the two-dimensional plane in the specified projection relationship, and determining the two-dimensional plane according to the two-dimensional coordinates Standard cuboid in the middle;
将所述标准长方体图中预设面的一条边,与所述预设二维坐标系中一轴的夹角确定为第一夹角,将所述预设面中两条相邻边的夹角确定为第二夹角,以及将所述标准长方体图中与所述预设面相连的棱的方向确定为所述预设绘制方向。Determining an edge of the preset surface in the standard cuboid image with an axis of the predetermined two-dimensional coordinate system as a first angle, and clamping the two adjacent sides of the preset surface The angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
可选的,所述装置还包括:Optionally, the device further includes:
三维尺寸确定模块,用于确定所述标准长方体的长、宽、高,分别与所述标准长方体图的长、宽、高的对应关系;根据所述长方体图形中各顶点坐标,确定所述长方体图形的长、宽、高;利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的长方体的长、宽、高;a three-dimensional size determining module, configured to determine a length, a width, and a height of the standard cuboid, respectively corresponding to a length, a width, and a height of the standard cuboid figure; determining the cuboid according to coordinates of each vertex in the cuboid figure Length, width, and height of the graphic; determining the length, width, and height of the rectangular parallelepiped corresponding to the rectangular parallelepiped figure by using the correspondence relationship and the length, width, and height of the rectangular parallelepiped graphic;
信息传输模块,用于将所确定的长、宽、高输入三维绘图引擎。 An information transmission module for inputting the determined length, width, and height into the three-dimensional drawing engine.
根据本发明实施例的第三方面,提供一种电子设备,包括: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 the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the second angle to draw a target surface of the rectangular parallelepiped, the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
应用本发明实施例方案,通过两点绘制长方体图形的一个面,并通过第三点绘制长方体图形的其他五个面,从而实现长方体图形的绘制,由于用户可以通过两点控制长方体图形的长和宽,通过第三个点控制长方体图形的高,因此可以准确响应绘图指令,绘制出用户期望绘制的长方体图形,进而提高绘制长方体图形的准确性。Applying the scheme of the embodiment of the present invention, one side of the rectangular parallelepiped graphic is drawn by two points, and the other five faces of the rectangular parallelepiped graphic are drawn by the third point, thereby realizing the drawing of the rectangular parallelepiped graphic, because the user can control the length of the rectangular parallelepiped figure through two points. Wide, the height of the cuboid graphic is controlled by the third point, so the drawing instruction can be accurately responded, and the rectangular parallelepiped figure that the user desires to draw can be drawn, thereby improving the accuracy of drawing the rectangular parallelepiped figure.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本发明。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 diagram of drawing a rectangular parallelepiped figure using a two-point method in the related art.
图2A是本发明根据一示例性实施例示出的一种图形绘制方法的流程图。2A is a flow chart of a graphics rendering method according to an exemplary embodiment of the present invention.
图2B是本发明根据一示例性实施例示出的一种图形绘制示意图。FIG. 2B is a schematic diagram of drawing a diagram according to an exemplary embodiment of the present invention.
图2C是本发明根据一示例性实施例示出的一种样本数据组示意图。2C is a schematic diagram of a sample data set according to an exemplary embodiment of the present invention.
图2D是本发明根据一示例性实施例示出的一种对角顶点坐标确定示意图。FIG. 2D is a schematic diagram of determining diagonal vertex coordinates according to an exemplary embodiment of the present invention.
图2E是本发明根据一示例性实施例示出的另一种图形绘制示意图。 FIG. 2E is a schematic diagram showing another drawing of the present invention according to an exemplary embodiment.
图2F是本发明根据一示例性实施例示出的另一种图形绘制示意图。FIG. 2F is another schematic diagram of drawing according to an exemplary embodiment of the present invention.
图3是本发明根据一示例性实施例示出的另一种图形绘制方法的流程图。FIG. 3 is a flow chart of another method of drawing graphics according to an exemplary embodiment of the present invention.
图4是本发明根据一示例性实施例示出的一种图形绘制装置的框图。FIG. 4 is a block diagram of a graphics rendering apparatus according to an exemplary embodiment of the present invention.
图5是本发明根据一示例性实施例示出的一种用于图形绘制的装置的框图。FIG. 5 is a block diagram of an apparatus for graphics rendering, in accordance with an exemplary embodiment of the present invention.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。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 a determination."
如图1所示,根据用户操作指令在屏幕中确定P1点和P2点,将两个坐标点作为一对对角顶点,并基于预设规则,确定其他两个顶点坐标P3点和P4点,获得用于限定待绘制长方体图形大小的矩形P1P4P2P3。根据所确定的矩形反推一个长方体图形,长方体图形的六个顶点在矩形P1P4P2P3的边上,从而实现长方体图形的绘制。可见,当用户指定P1和P2点后,用户才能看到绘制获得的长方体图形,用户不能很好的通过控制两个点绘制出期望的长方体图形,即采用两点法绘制出的长方体图形与用户预期绘制出的长方体图形具有差距,导致绘制出的长方体图形准确度低。当差距较大时,用户需要删除后重新绘制,从而导致绘制效率低。As shown in FIG. 1, the P1 point and the P2 point are determined on the screen according to the user operation instruction, the two coordinate points are used as a pair of diagonal vertices, and the other two vertex coordinates P3 and P4 are determined based on the preset rule. A rectangle P1P4P2P3 for defining the size of the cuboid pattern to be drawn is obtained. A rectangular parallelepiped figure is inversely pushed according to the determined rectangle, and the six vertices of the rectangular parallelepiped figure are on the side of the rectangle P1P4P2P3, thereby realizing the drawing of the rectangular parallelepiped figure. It can be seen that when the user specifies the P1 and P2 points, the user can see the cuboid figure drawn by the drawing, and the user can not draw the desired cuboid figure by controlling the two points very well, that is, the cuboid figure and the user drawn by the two-point method. It is expected that the drawn rectangular parallelepiped pattern has a gap, resulting in a low accuracy of the drawn rectangular parallelepiped pattern. 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 rectangular parallelepiped pattern has low accuracy, the present invention provides a graphic drawing method. You can draw a face of the cuboid figure through two points and draw the other five faces of the cuboid figure through the third point to realize the drawing of the cuboid figure. Since the user can control the length and width of the cuboid figure through two points, pass the third The point controls the height of the cuboid graphic, so it can actively respond to the drawing instruction, draw the rectangular parallelepiped figure that the user desires to draw, and thereby improve the accuracy of drawing the rectangular parallelepiped figure. Next, the solution of the present invention will be described in detail.
本发明实施例可以应用在智能设备中,智能设备可以是智能白板、智能手机、智能学习机、平板电脑、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 whiteboard, 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 the finger or the stylus pen to draw the graphic on the touch screen of the smart device, or use the mouse to control the cursor on the screen of the smart device for graphic drawing, and the smart device can receive the drawing instruction generated by the user operation, and according to the drawing instruction. Determine the three-point coordinates and then draw the graph.
其中,关于坐标点获取与图形绘制的顺序,可以在获取到第一点坐标、第二点坐标以及第三点坐标以后,再进行长方体图形所有面的绘制;也可以在获取第一个点坐标和第二点坐标后,先进行长方体图形的目标面绘制,然后获取第三点坐标,并进行长方体图形的其他面的绘制。以下结合附图进行示例说明。Wherein, 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 rectangular parallelepiped graphic may be drawn; or the first point coordinate may be obtained. After the coordinates of the second point, the target surface of the rectangular figure is drawn first, then the coordinates of the third point are obtained, and the other faces of the rectangular figure are drawn. The following is exemplified in conjunction with the drawings.
如图2A所示,图2A是本发明根据一示例性实施例示出的一种图形绘制方法的流程图,包括以下步骤201至步骤204:As shown in FIG. 2A, FIG. 2A is a flowchart of a graphic drawing method according to an exemplary embodiment of the present invention, which includes the following steps 201 to 204:
在步骤201中,获取第一点坐标;获取第二点坐标;In step 201, the first point coordinates are acquired; the second point coordinates are acquired;
在步骤202中,将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;In step 202, the first point coordinate and the second point coordinate are used as coordinates of a pair of diagonal vertices, and the target face of the rectangular parallelepiped figure is drawn in combination with the preset first angle and the second angle, the first The two angles are the angles of two adjacent sides in the preset surface in the preset standard rectangular parallelepiped, and the first angle is a preset two-dimensional coordinate system in one of the preset surfaces and the two-dimensional plane The angle of one axis;
在步骤203中,获取第三点坐标;In step 203, acquiring third point coordinates;
在步骤204中,基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。In step 204, other faces of the cuboid figure are drawn based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is in the standard cuboid figure and Set the direction of the edges of the faces.
关于点坐标的确定,在一个例子中,三个点坐标均通过点击指令所对应的点击位置确定。其中,点击指令可以是鼠标点击指令、手指点击指令、或触摸笔点击指令等。用户可以分别点击三个不连续的点,设备根据点击顺序,将三个不连续的点分别确定为第一点、第二点、第三点。例如,根据第一个点击指令,获取第一点坐标,根据第二个点击指令,获取第二点坐标,根据第三个点击指令,获取第三点坐标。Regarding the determination of the point coordinates, in one example, the three point coordinates are determined by the click position corresponding to the click command. The click command may be a mouse click command, a finger click command, or a touch pen click command. 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 cuboid figure through three points, in the drawing process, the first point coordinates, the second point The coordinates and the coordinates of the third point are directly determined by the click operation, and after the first point coordinate and the second point coordinate are determined, the length and width of the cuboid figure cannot be modified, and after the third point coordinate is determined, the cuboid cannot be modified. In order to overcome such a defect, the embodiment of the present invention further provides another implementation manner, which can dynamically adjust the second point coordinate to dynamically adjust the length and width of the rectangular figure, and when receiving the second confirmation command The coordinates at this time are taken as the final second point coordinates to achieve the final confirmation of the length and width. In addition, the third point coordinate can be dynamically adjusted to dynamically adjust the height in the cuboid image. When the third point confirmation command is received, the coordinate at this time is used as the final third point coordinate to achieve high final confirmation. .
本实现方式中,可以通过拖拽(牵引、滑动、移动)的方式绘制长方体图形。在绘制过程中,将用户首次触发的点作为第一点,从而获得第一点坐标。以第一点为起点进行滑动,该滑动轨迹中的任意点均可作为第二点。根据第一点和当前第二点进行目标面的绘制,随着第二点坐标不断变化,目标面也随之变化,通过调整第二点的坐标,可以绘制出用户期望的目标面。当接收到第二点确认指令时,将此时的坐标作为最终的第二点坐标,以实现长和宽的最终确认。第二点确认指令可以是鼠标点击指令、手指/触摸笔点击指令、或者按压指令等。同理,以第二点为起点进行滑动,该滑动轨迹中的任意点均可以作为第三点。根据目标面和第三点进行其他五个面的绘制,随着第三点坐标不断变化,其他五个面也随之变化,通过调整第三点的坐标,可以绘制出用户期望的高,从而获得期望的长方体图形。In this implementation manner, a rectangular parallelepiped 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 target surface is drawn. As the coordinate of the second point changes continuously, the target surface also changes. By adjusting the coordinates of the second point, the target 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 the final confirmation of the length and width. The second confirmation command may be a mouse click command, a finger/touch pen click command, or a press command. Similarly, the second point is used as the starting point for sliding, and any point in the sliding track can be used as the third point. According to the target surface and the third point, the other five faces are drawn. As the coordinate of the third point changes continuously, the other five faces also change. By adjusting the coordinates of the third point, the user's desired height can be drawn, thereby Obtain the desired cuboid graphic.
如图2B所示,图2B是本发明根据一示例性实施例示出的一种图形绘制示意图。第一点(P1点)到最终的第二点(P2点),以及最终的第二点到最终的第三点(P3点),展示出来的图呈现动态效果,每更改第二点的坐标均会重新绘制目标面,每更改第三点的坐标均会重新绘制其他五个面。在确定目标面后,通过移动第三点,可以呈现出根据第二点和第三点的距离按预设绘制方向拉伸目标面的动态效果。FIG. 2B is a schematic diagram showing a drawing of the present invention according to an exemplary embodiment. 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 target faces are redrawn, and the other five faces are redrawn each time the coordinates of the third point are changed. After the target surface is determined, by moving the third point, a dynamic effect of stretching the target surface in the preset drawing direction according to the distance between the second point and the third point can be presented.
为了示意方便,图2B仅列举绘制过程中五个状态进行示例说明。在绘图过程中,用户点击的第一个点作为第一点(P1点),以P1点为起点进行拖动,拖动轨迹中任何一点均为第二点,针对每个第二点均动态绘制相应的目标面,图2B以拖动轨迹中P2’点为例进行示例说明,根据P1和P2’绘制获得如图2B中状态二所示的目标面。当拖动到P2点时,如果接收到确认指令,则将该点确定为最终的第二点,并绘制获得最终的目标面,如图2B中状态三所示。然后,以第二点为起点进行拖动,拖动轨迹中任何一点均为第三点,针对每个第三点均动态绘制相应的长方体图形的其他五个面,图2B以拖动轨迹中P3’点为例进行示例说明,根据状态三所示的目标面和P3’点绘制获得如图2B中状态四所示的长方体图。当拖动到P3点时,如果接收到确认指令,则将该点确定为最终的第三点,并绘制获得最终的长方体图形, 如图2B中状态五所示。For convenience of illustration, FIG. 2B only exemplifies five 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 target surface is drawn, and FIG. 2B is exemplified by taking the P2' point in the drag track as an example, and the target surface 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 target surface is drawn to be obtained, as shown by state three in FIG. 2B. Then, dragging with the second point as the starting point, any point in the dragging track is the third point, and the other five faces of the corresponding rectangular parallelepiped graphic are dynamically drawn for each third point, and FIG. 2B is dragged in the track. The P3' point is exemplified as an example, and a rectangular parallelepiped chart as shown in state four in Fig. 2B is obtained according to the target plane and the P3' point drawing shown in the state three. When dragging to the P3 point, if a confirmation command is received, the point is determined as the final third point, and the final cuboid figure is drawn. As shown in state 5 in Figure 2B.
接下来对根据三个点绘制长方体图形进行介绍。Next, we will introduce the drawing of the cuboid figure based on three points.
首先,对第一夹角、第二夹角以及预设绘制方向进行介绍。First, the first angle, the second angle, and the preset drawing direction are introduced.
第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,第一夹角为预设面中一条边与二维平面中预设二维坐标系的一轴的夹角,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。预设面是标准长方体图中的一面,例如,可以是标准长方体图中的顶面、底面、侧面等任意一面。为了适应用户的绘图习惯,预设面为标准长方体图中的顶面。棱的方向是棱所在直线的方向。本发明实施例是想根据标准长方体图中的第一夹角、第二夹角以及预设绘制方向,期望实现所绘制出的长方体图形的目标面中某相邻边的夹角为第二夹角,目标面中一条边与二维平面中预设二维坐标系的一轴的夹角为第一夹角,长方体图形中与所述目标面相邻的棱的方向为预设绘制方向。The second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped image, and the first angle is an axis of the preset surface and an axis of the preset two-dimensional coordinate system in the two-dimensional plane The angle of the preset drawing is the direction of the edge of the standard cuboid image connected to the preset surface. The preset surface is one side of the standard rectangular parallelepiped image, for example, it may be any one of the top surface, the bottom surface, and the side surface in the standard rectangular parallelepiped image. In order to adapt to the user's drawing habits, the preset surface is the top surface in the standard cuboid image. The direction of the rib is the direction of the line where the rib is located. In the embodiment of the present invention, according to the first angle, the second angle, and the preset drawing direction in the standard rectangular parallelepiped drawing, it is desirable to realize the angle between an adjacent side of the target plane of the drawn rectangular parallelepiped figure as the second clip. The angle between the edge of the target surface and the axis of the preset two-dimensional coordinate system in the two-dimensional plane is the first angle, and the direction of the edge adjacent to the target surface in the rectangular parallelepiped pattern is the preset drawing direction.
如图2C所示,图2C是本发明根据一示例性实施例示出的一种样本数据组示意图。样本数据组包括第一夹角、第二夹角和预设绘制方向。在该示意图中,标准长方体图中顶点O与二维坐标系中的原点重合,OC与OX的夹角α即为第一夹角,AO与AB的夹角β即为第二夹角,BD所在直线的两个方向即为预设绘制方向。As shown in FIG. 2C, FIG. 2C is a schematic diagram of a sample data set according to an exemplary embodiment of the present invention. The sample data set includes a first angle, a second angle, and a preset drawing direction. In the schematic diagram, the vertex O in the standard cuboid map coincides with the origin in the two-dimensional coordinate system, the angle α between OC and OX is the first angle, and the angle β between AO and AB is the second angle, BD The two directions of the line are the preset drawing directions.
本实施例根据获取的第一点坐标、第二点坐标以及第三点坐标,并结合标准长方体的第一夹角、第二夹角以及预设绘制方向,可以绘制出与标准长方体有关联的长方体图形。In this embodiment, according to the obtained first point coordinate, the second point coordinate, and the third point coordinate, and combined with the first angle, the second angle, and the preset drawing direction of the standard rectangular parallelepiped, the standard rectangular parallelepiped may be drawn. Cuboid graphics.
长方体图形是二维平面上绘制出的图形,为了使长方体图形具有真实性,可以将长方体按照指定投影关系投影到二维平面上形成的图形作为长方体图形。基于此,在一个例子中,所述标准长方体图是将标准长方体按照指定投影关系投影到二维平面上的投影图形,所述第一夹角、第二夹角以及预设绘制方向基于所述指定投影关系获得。预设绘制方向其中,所述投影关系包括长方体的放置角度、长方体与投影设备的距离、投影方向以及投影方式等。投影设备可以是相机等设备。投影方式包括正交投影等方式。投影方向包括朝向XOY面进行投影、朝向XOZ面进行投影以及朝向YOZ面进行投影等,在此不做限制。The rectangular parallelepiped graphic is a graphic drawn on a two-dimensional plane. In order to make the rectangular parallelepiped graphic realistic, a graphic formed by projecting a rectangular parallelepiped onto a two-dimensional plane according to a specified projection relationship may be used as a rectangular parallelepiped graphic. Based on this, in one example, the standard cuboid map is a projection graph that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and the preset drawing direction are based on the Specifies the projection relationship to get. The preset drawing direction includes the placement angle of the rectangular parallelepiped, the distance between the rectangular parallelepiped and the projection device, the projection direction, and the projection manner. 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.
由于只要长方体投影到二维平面上的投影关系固定,则无论长方体的尺寸如何变化,长方体投影到二维平面上所形成的长方体图形的第一夹角、第二夹角、以及预设绘制方向固定不变。因此,利用标准长方体图形中的第一夹角、第二夹角以及预设绘制方向,以及绘图过程中获取的第一点坐标、第二点坐标以及第三点坐标,可以绘制出与标准长方体投影关系相同的长方体图形,长方体图形的长宽高会根据第一点坐标、第二点坐标以及第三点坐标进行 变动,从而提高长方体图形的真实性。其中,长方体图形的长、宽和高,是二维图形中三条不同边的长度。Since the projection relationship of the rectangular parallelepiped projection onto the two-dimensional plane is fixed, the first angle, the second angle, and the preset drawing direction of the rectangular parallelepiped formed by the rectangular parallelepiped projection onto the two-dimensional plane, regardless of the change in the size of the rectangular parallelepiped. stable. Therefore, using the first angle, the second angle, and the preset drawing direction in the standard rectangular parallelepiped graphic, and the first point coordinate, the second point coordinate, and the third point coordinate obtained during the drawing process, the standard rectangular parallelepiped can be drawn. The rectangular parallelepiped graphics with the same projection relationship, the length, width and height of the rectangular parallelepiped graphics are based on the first point coordinates, the second point coordinates, and the third point coordinates. Change to improve the authenticity of the rectangular figure. Among them, the length, width and height of the rectangular figure are the lengths of three different sides in the two-dimensional figure.
本实施例中可以预存至少一种投影关系的样本数据组,样本数据组包括同一种投影关系下的第一夹角、第二夹角以及预设绘制方向。In this embodiment, at least one sample data group of the projection relationship may be pre-stored, and the sample data group includes a first angle, a second angle, and a preset drawing direction in the same projection relationship.
在一个可选的实现方式中,固定存储一种投影关系的样本数据组,每次进行图形绘制时,均采用该样本数据组中的参数进行绘制。In an optional implementation manner, a sample data set of a projection relationship is fixedly stored, and each time the graphic is drawn, the parameters in the sample data set are used for drawing.
在另一个可选的实现方式中,可以存储多种投影关系对应的样本数据组。在绘制长方体图形前,确定样本数据组。例如,基于投影关系设置界面,接收投影关系设置指令,根据所述投影关系设置指令确定投影关系,进而确定相应的样本数据组,然后根据确定的样本数据组进行长方体图形绘制。设置界面中可以直接以文字的方式描述投影关系,也可以每种投影关系所对应的标准长方体图进行提示,便于用户查看每种投影关系的展示效果,从而快速进行投影关系设置。In another optional implementation, a sample data set corresponding to multiple projection relationships may be stored. Determine the sample data set before drawing the box. For example, based on the projection relationship setting interface, receiving a projection relationship setting instruction, determining a projection relationship according to the projection relationship setting instruction, thereby determining a corresponding sample data group, and then performing a rectangular parallelepiped graphic drawing according to the determined sample data group. In the setting interface, the projection relationship can be directly described by text, or the standard rectangular parallelepiped corresponding to each projection relationship can be prompted, so that the user can view the display effect of each projection relationship, thereby quickly setting the projection relationship.
本发明实施例还提供一种生成第一夹角、第二夹角和预设绘制方向的方法,所述方法包括以下步骤:The embodiment of the invention further provides a method for generating a first angle, a second angle and a preset drawing direction, the method comprising the following steps:
在按照指定投影关系将标准长方体从三维空间投影到二维平面时,获取所述标准长方体各顶点的三维坐标;Obtaining three-dimensional coordinates of each vertex of the standard cuboid when projecting a standard cuboid from a three-dimensional space to a two-dimensional plane according to a specified projection relationship;
基于所述指定投影关系下三维空间到二维平面的投影矩阵,将各顶点的三维坐标转换为相应顶点在预设二维坐标系上的二维坐标,根据所述二维坐标确定二维平面中的标准长方体图;And transforming the three-dimensional coordinates of each vertex into two-dimensional coordinates of the corresponding vertex on a preset two-dimensional coordinate system according to the projection matrix of the three-dimensional space to the two-dimensional plane in the specified projection relationship, and determining the two-dimensional plane according to the two-dimensional coordinates Standard cuboid in the middle;
将所述标准长方体图中预设面的一条边,与所述预设二维坐标系中一轴的夹角确定为第一夹角,将所述预设面中两条相邻边的夹角确定为第二夹角,以及将所述标准长方体图中与所述预设面相连的棱的方向确定为所述预设绘制方向。Determining an edge of the preset surface in the standard cuboid image with an axis of the predetermined two-dimensional coordinate system as a first angle, and clamping the two adjacent sides of the preset surface The angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
在该实施例中,标准长方体是预先设置的用为基准的长方体,在一个例子中,标准长方体可以是三维尺寸可以为X0=Y0=Z0=1的正方体。在指定投影关系下,保持标准长方体的放置角度、标准长方体与投影设备的距离、投影方向以及投影方式不变,则可以获取到指定投影关系下标准长方体在三维坐标系中各顶点的三维坐标。由于指定投影关系已知,则可以获取三维空间到二维平面的投影矩阵Mp,基于指定投影关系对应的投影矩阵,可以根据公式P二维=P三维*Mp计算标准长方体各顶点在二维平面的投影坐标。以图2C为例,在获取到顶点O、A、B、C、D的二维坐标后,根据向量积公式可知: In this embodiment, the standard cuboid is a pre-set cuboid used as a reference. In one example, the standard cuboid may be a cube having a three-dimensional size of X 0 = Y 0 = Z 0 =1. Under the specified projection relationship, the three-dimensional coordinates of the vertices of the standard cuboid in the three-dimensional coordinate system under the specified projection relationship can be obtained by keeping the placement angle of the standard cuboid, the distance between the standard cuboid and the projection device, the projection direction, and the projection mode. Because of known relationships specify a projection, it is possible to obtain three-dimensional space to two-dimensional plane of the projection matrix Mp, based on a specified projection relationship corresponding projection matrix, using the formula P = P D * Mp dimensional calculation of the standard two-dimensional plane at each vertex of a rectangular parallelepiped Projection coordinates. Taking FIG. 2C as an example, after obtaining the two-dimensional coordinates of the vertices O, A, B, C, and D, according to the vector product formula, it can be known that:
AO·AB=|AO||AB|·cosβAO·AB=|AO||AB|·cosβ
从而可以获得第二夹角β:Thereby a second angle β can be obtained:
Figure PCTCN2017104850-appb-000001
Figure PCTCN2017104850-appb-000001
同理,可获得第一夹角α:Similarly, the first angle α can be obtained:
Figure PCTCN2017104850-appb-000002
Figure PCTCN2017104850-appb-000002
其中,X的坐标可以取值为(1,0)。The coordinate of X can be taken as (1, 0).
另外,将所述标准长方体中与所述面相连的棱的方向确定为所述预设绘制方向,例如,将BD所在直线的方向确定为预设绘制方向,该预设绘制方向可以包括向量
Figure PCTCN2017104850-appb-000003
的方向和向量
Figure PCTCN2017104850-appb-000004
的方向。
In addition, a direction of an edge of the standard cuboid connected to the surface is determined as the preset drawing direction, for example, a direction of a line where the BD is located is determined as a preset drawing direction, and the preset drawing direction may include a vector.
Figure PCTCN2017104850-appb-000003
Direction and vector
Figure PCTCN2017104850-appb-000004
The direction.
接着,在获得第一夹角、第二夹角以及预设绘制方向后,可以进行图形绘制。在绘制过程中,将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,包括:Then, after obtaining the first angle, the second angle, and the preset drawing direction, the graphic drawing can be performed. In the drawing process, the first point coordinate and the second point coordinate are used as coordinates of a pair of diagonal vertices, and the target surface of the rectangular parallelepiped graphic is drawn in combination with the preset first angle and the second angle, including:
将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角确定另一对对角顶点的坐标;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and determining coordinates of another pair of diagonal vertices in combination with the preset first angle and the second angle;
根据两对对角顶点的坐标绘制长方体图形的目标面。The target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
其中,本实施例期望绘制出的目标面中一条边与预设二维坐标系中的一轴夹角为第一夹角,期望目标面中某两条相邻边的夹角为第二夹角。在二维平面中,已知目标面中一条边与二维坐标系中一轴的夹角、目标面中相邻边的夹角、以及目标面中两个顶点,则可以根据三角关系获得目标面中另一对对角顶点的坐标。The angle between an edge of the target surface and the axis of the preset two-dimensional coordinate system is the first angle, and the angle between two adjacent edges of the target surface is the second clamp. angle. In the two-dimensional plane, it is known that the angle between one edge of the target surface and one axis in the two-dimensional coordinate system, the angle between adjacent edges in the target surface, and the two vertices in the target surface can obtain the target according to the triangular relationship. The coordinates of another pair of diagonal vertices in the face.
在一个例子中,为了提高计算效率,所述结合预设的第一夹角和第二夹角确定另一对对角顶点的坐标,包括:In one example, in order to improve computational efficiency, the combination of the preset first angle and the second angle determine coordinates of another pair of diagonal vertices, including:
获取新二维坐标系,所述新二维坐标系与所述预设二维坐标系的原点相同、且所述新二维坐标系与所述预设二维坐标系相应轴的夹角为第一夹角;Obtaining a new two-dimensional coordinate system, the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
基于预设二维坐标系到新二维坐标系的变换矩阵,将预设二维坐标系中所述第一点坐标和第二点坐标变换到新二维坐标系,获得新二维坐标系下的第一点新坐标和第二点新坐标; Based on the transformation matrix of the preset two-dimensional coordinate system to the new two-dimensional coordinate system, the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system are transformed into a new two-dimensional coordinate system to obtain a new two-dimensional coordinate system. The first point of the new coordinate and the second point of the new coordinate;
根据所述第一点新坐标、第二点新坐标以及预设的第二夹角,确定另一对对角顶点在新二维坐标系中的坐标。And determining coordinates of another pair of diagonal vertices in the new two-dimensional coordinate system according to the first point new coordinate, the second point new coordinate, and the preset second angle.
本实施例中,预设二维坐标系又可以称为原二维坐标系,新二维坐标系可以是预先建立的二维坐标系,也可以在接收到绘制指令时建立的二维坐标系。新二维坐标系与所述预设二维坐标系相应轴的夹角为第一夹角,目的是为了使新二维坐标系的其中一轴与所述目标面的一条边在同一条直线上,从而可以提高确定另一对对角顶点坐标的效率。所谓相应轴的夹角为第一夹角,即新二维坐标系X轴与预设二维坐标系X轴的夹角为第一夹角,新二维坐标系Y轴与预设二维坐标系Y轴的夹角为第一夹角。可以理解的是,如果第一夹角为零,则无需建立新二维坐标系。In this embodiment, the preset two-dimensional coordinate system may be referred to as a original two-dimensional coordinate system, and the new two-dimensional coordinate system may be a pre-established two-dimensional coordinate system, or may be a two-dimensional coordinate system established when receiving a drawing instruction. . The angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is the first angle, so that one of the axes of the new two-dimensional coordinate system is on the same line as one edge of the target surface. Up, thereby improving the efficiency of determining the coordinates of another pair of diagonal vertices. The angle between the corresponding axes is the first angle, that is, the angle between the X-axis of the new two-dimensional coordinate system and the X-axis of the preset two-dimensional coordinate system is the first angle, and the new two-dimensional coordinate system Y-axis and the preset two-dimensional The angle between the Y-axis of the coordinate system is the first angle. It can be understood that if the first angle is zero, it is not necessary to establish a new two-dimensional coordinate system.
由于新二维坐标系x'oy'与预设二维坐标系xoy的夹角为第一夹角α,因此,可以根据α值计算坐标系x'oy'与xoy的映射关系,如下:Since the angle between the new two-dimensional coordinate system x'oy' and the preset two-dimensional coordinate system xoy is the first angle α, the mapping relationship between the coordinate system x'oy' and xoy can be calculated according to the alpha value, as follows:
坐标系xoy到坐标系x'oy'的变换矩阵为:The transformation matrix of the coordinate system xoy to the coordinate system x'oy' is:
Figure PCTCN2017104850-appb-000005
Figure PCTCN2017104850-appb-000005
坐标系x'oy'到坐标系xoy的变换矩阵为:The transformation matrix of the coordinate system x'oy' to the coordinate system xoy is:
Figure PCTCN2017104850-appb-000006
Figure PCTCN2017104850-appb-000006
基于预设二维坐标系到新二维坐标系的变换矩阵,可以将第一点坐标和第二点坐标变换到新二维坐标系,获得新二维坐标系下的第一点新坐标和第二点新坐标,并根据第一点新坐标、第二点新坐标以及预设的第二夹角,确定另一对对角顶点在新二维坐标系中的坐标。Based on the transformation matrix of the preset two-dimensional coordinate system to the new two-dimensional coordinate system, the first point coordinate and the second point coordinate can be transformed into a new two-dimensional coordinate system to obtain the first point new coordinate and the new two-dimensional coordinate system. The second point is a new coordinate, and the coordinates of the other pair of diagonal vertices in the new two-dimensional coordinate system are determined according to the first point new coordinate, the second point new coordinate, and the preset second angle.
关于根据两对对角顶点的坐标绘制长方体图形的目标面,在一个例子中,在确定另一对对角顶点在新二维坐标系中的坐标后,可以基于两对对角顶点在新二维坐标系中的坐标绘制目标面。Regarding the target plane of the cuboid graph based on the coordinates of the two pairs of diagonal vertices, in one example, after determining the coordinates of the other pair of diagonal vertices in the new two-dimensional coordinate system, the two pairs of diagonal vertices may be based on the new two The coordinates in the dimension coordinate system draw the target surface.
在另一个例子中,可以基于新二维坐标系到预设二维坐标系的变换矩阵,将获得的另一对对角顶点的坐标变换到预设二维坐标系中,获得另一对对角顶点在预设二维坐标系中的坐标,并基于两对对角顶点在预设二维坐标系中的坐标绘制目标面。 In another example, the coordinates of another pair of diagonal vertices obtained may be transformed into a preset two-dimensional coordinate system based on a transformation matrix of the new two-dimensional coordinate system to a preset two-dimensional coordinate system, and another pair is obtained. The coordinates of the angular vertices in the preset two-dimensional coordinate system, and the target surface is drawn based on the coordinates of the two pairs of diagonal vertices in the preset two-dimensional coordinate system.
为了方便理解,本实施例以图2D为例进行示例说明。图2D是本发明根据一示例性实施例示出的一种对角顶点坐标确定示意图。在该图中,包括预设二维坐标系xoy、新二维坐标系x'oy'、目标面A'OC'B'。新二维坐标系x'oy'与预设二维坐标系xoy的原点相同、且新二维坐标系x'oy'中X轴与目标面A'OC'B'的OC'边在同一条直线上,将第一点坐标P1和第二点坐标P2作为一对对角顶点O和B'的坐标。进一步的,为了提高计算效率,第一点坐标P1与预设二维坐标系xoy和新二维坐标系x'oy'的原点重合。For convenience of understanding, the present embodiment is illustrated by taking FIG. 2D as an example. FIG. 2D is a schematic diagram of determining diagonal vertex coordinates according to an exemplary embodiment of the present invention. In the figure, a preset two-dimensional coordinate system xoy, a new two-dimensional coordinate system x'oy', and a target surface A'OC'B' are included. The new two-dimensional coordinate system x'oy' is the same as the origin of the preset two-dimensional coordinate system xoy, and the X-axis of the new two-dimensional coordinate system x'oy' is the same as the OC' edge of the target surface A'OC'B' On the straight line, the first point coordinate P1 and the second point coordinate P2 are taken as coordinates of a pair of diagonal vertices O and B'. Further, in order to improve the calculation efficiency, the first point coordinate P1 coincides with the origin of the preset two-dimensional coordinate system xoy and the new two-dimensional coordinate system x'oy'.
在绘图过程中,获取第P1点坐标和第P2点坐标,且将第P1点坐标和第P2点坐标作为一对对角顶点O和B'的坐标后,可以通过Px'oy'=Pxoy*Mo将P1和P2两点变换到x'oy'坐标系,获得第一点新坐标P1’和第二点新坐标P2’,并在x'oy'坐标系中,结合第二夹角β值计算出A'和C'在x'oy'坐标系中的坐标。在x'oy'坐标系中,A'和C'的坐标如下:In the drawing process, the coordinates of the P1 point and the coordinates of the P2 point are obtained, and the coordinates of the P1 point and the coordinates of the P2 point are taken as the coordinates of a pair of diagonal vertices O and B', and may pass P x 'oy' = P Xoy *Mo transforms the two points P1 and P2 into the x'oy' coordinate system, obtaining the first point new coordinate P1' and the second point new coordinate P2', and in the x'oy' coordinate system, combining the second angle The beta value calculates the coordinates of A' and C' in the x'oy' coordinate system. In the x'oy' coordinate system, the coordinates of A' and C' are as follows:
A'=[P1'.X-(P2'.Y-P1'.Y)*cotβ,P2'.Y]A'=[P1'.X-(P2'.Y-P1'.Y)*cotβ,P2'.Y]
C'=[P1'.X+(P2'.X-A'.X),P1'.Y]C'=[P1'.X+(P2'.X-A'.X), P1'.Y]
其中,P1'.X-(P2'.Y-P1'.Y)*cotβ表示A'的横坐标,P2'.Y表示A'的纵坐标,P1'.X+(P2'.X-A'.X)表示C'的横坐标,P1'.Y表示C'的纵坐标,P1'.X表示P1的横坐标,P1'.Y表示P1的纵坐标,P2'.X表示P2的横坐标,P2'.Y表示P2的纵坐标,A'.X表示A'的横坐标。由于第一点新坐标P1’和第二点新坐标P2’、以及β已确定,因此可以获得A'和C'的坐标。Where P1'.X-(P2'.Y-P1'.Y)*cotβ represents the abscissa of A', P2'.Y represents the ordinate of A', P1'.X+(P2'.X-A' .X) denotes the abscissa of C', P1'.Y denotes the ordinate of C', P1'.X denotes the abscissa of P1, P1'.Y denotes the ordinate of P1, and P2'.X denotes the abscissa of P2 , P2'.Y represents the ordinate of P2, and A'.X represents the abscissa of A'. Since the first point new coordinate P1' and the second point new coordinate P2', and β have been determined, the coordinates of A' and C' can be obtained.
在确定目标面后,可以获取第三点坐标,基于第二点坐标、第三点坐标以及预设绘制方向,确定其他四个顶点坐标,根据所获得的坐标绘制所述长方体图形的其他面。After determining the target surface, the third point coordinate may be acquired, and the other four vertex coordinates are determined based on the second point coordinate, the third point coordinate, and the preset drawing direction, and the other faces of the cuboid figure are drawn according to the obtained coordinates.
由于投影关系确定的情况下,第一夹角、第二夹角以及预设绘制方向固定,因此在目标面确定后,与目标面相邻的棱按照预设绘制方向延伸。预设绘制方向可以包括一条直线的两个方向,则可以根据第三点相对于第二点的移动方向,确定预设绘制方向。例如,选取两个方向中与所述移动方向的夹角小于90度的方向,作为当前所需的预设绘制方向。Since the projection relationship is determined, the first angle, the second angle, and the preset drawing direction are fixed. Therefore, after the target surface is determined, the edge adjacent to the target surface extends in the preset drawing direction. The preset drawing direction may include two directions of a straight line, and the preset drawing direction may be determined according to the moving direction of the third point relative to the second point. For example, a direction in which the angle between the two directions and the moving direction is less than 90 degrees is selected as the currently required preset drawing direction.
根据第二点坐标与第三点坐标在预设绘制方向上的投影距离,可以确定长方体图形的高,并按预设绘制方向、高、以及目标面中的四个顶点,计算其他四个顶点的坐标,并根据所获得的顶点坐标以及目标面中四个顶点坐标绘制其他面,从而获得长方体图。According to the projection distance of the second point coordinate and the third point coordinate in the preset drawing direction, the height of the rectangular figure can be determined, and the four vertices in the target direction, the height, and the target surface are calculated according to the preset, and the other four vertices are calculated. The coordinates are drawn, and other faces are drawn according to the obtained vertex coordinates and the coordinates of the four vertices in the target face, thereby obtaining a rectangular parallelepiped chart.
由于在投影关系确定的情况下,预设绘制方向固定,因此,不管第二点到第三点的方向是否与预设绘制方向一致,在绘制长方体图形中与目标面相邻的棱时,均按照预设绘制方 向绘制。图2B以P2到P3的移动方向与预设绘制方向一致为例进行示例说明。Since the preset drawing direction is fixed in the case where the projection relationship is determined, regardless of whether the direction of the second point to the third point is consistent with the preset drawing direction, when drawing the edge adjacent to the target surface in the rectangular parallelepiped pattern, Drawing by default Draw to. FIG. 2B illustrates an example in which the moving direction of P2 to P3 is consistent with the preset drawing direction.
如图2E所示,图2E是本发明根据一示例性实施例示出的另一种图形绘制示意图。图2E以P2到P3的移动方向与预设绘制方向不一致为例进行示例说明。在该示意图中,鼠标拖动的方向为P1到P2,P2到P3。P1到P2的过程中可以绘制出若干个目标面,若在P2点接收到确认指令,将此时绘制的目标面作为最终的目标面。由于预设绘制方向包括y轴的正方向以及负方向,又由于鼠标的移动方向为P2到P3,P2P3与y轴的负方向的夹角小于90度,因此,预设绘制方向为y轴的负方向,根据P2与P3的距离可以确定P2与D’的长度,进而获得其他四个顶点D’、E’、F’、G’的坐标,并根据所获得的顶点坐标以及目标面中四个顶点坐标绘制其他面,从而获得长方体图形。FIG. 2E is a schematic diagram showing another drawing according to an exemplary embodiment of the present invention. FIG. 2E illustrates an example in which the moving direction of P2 to P3 is inconsistent with the preset drawing direction. In this diagram, the direction of mouse drag is P1 to P2, P2 to P3. During the process from P1 to P2, several target faces can be drawn. If a confirmation command is received at point P2, the target surface drawn at this time is taken as the final target surface. Since the preset drawing direction includes the positive direction and the negative direction of the y-axis, and since the moving direction of the mouse is P2 to P3, the angle between the P2P3 and the negative direction of the y-axis is less than 90 degrees, and therefore, the preset drawing direction is the y-axis. In the negative direction, the lengths of P2 and D' can be determined according to the distance between P2 and P3, and the coordinates of the other four vertices D', E', F', G' are obtained, and according to the obtained vertex coordinates and the target surface The other coordinates of the vertex coordinates are drawn to obtain a rectangular parallelepiped graphic.
相关技术中,往往通过二维绘图引擎绘制不可转动的长方体图形,例如采用两点法绘制;也可以通过三维绘图引擎绘制可以转动的长方体图形,例如,用户手动输入长方体的长宽高,三维绘图引擎即可绘制出相应的长方体,并支持转动功能。可以理解的是,二维绘图引擎和三维绘图引擎绘制出的图为二维平面图。二维绘图引擎绘制出的是固定投影关系的长方体图形,因此不可转动。由于输入三维绘图引擎的三维尺寸是长方体的实际尺寸,因此三维绘图引擎绘可以根据转动指令绘制出不同投影关系下的长方体图形。三维绘图引擎绘制出的长方体图形的长宽高是图形中三条不同边的长度。In the related art, a non-rotatable rectangular parallelepiped graphic is often drawn by a two-dimensional drawing engine, for example, by a two-point method; a rectangular parallelepiped graphic can also be drawn by a three-dimensional drawing engine, for example, a user manually inputs a length, a height, and a height of a rectangular parallelepiped, and a three-dimensional drawing. The engine can draw the corresponding cuboid and support the rotation function. 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 rectangular parallelepiped graphic with a fixed projection relationship and therefore cannot be rotated. Since the three-dimensional size of the input three-dimensional drawing engine is the actual size of the rectangular parallelepiped, the three-dimensional drawing engine can draw a rectangular parallelepiped figure under different projection relationships according to the rotation instruction. The length, width, and height of the cuboid graphic drawn by the 3D drawing engine are the lengths of three different sides in the drawing.
然而,二维绘图引擎和三维绘图引擎都独立使用,无法实现利用二维绘图引擎绘制出长方体图形后,利用三维绘图引擎展示该长方体图形对应的实际长方体在不同投影关系下的长方体图形。用户只能分别利用二维绘图引擎和三维绘图引擎进行绘制,绘图效率低,且用户体验差。However, the two-dimensional drawing engine and the three-dimensional drawing engine are used independently. After the rectangular parallelepiped drawing is drawn by the two-dimensional drawing engine, the three-dimensional drawing engine is used to display the rectangular parallelepiped figure of the actual rectangular parallelepiped corresponding to the rectangular parallelepiped in different projection relationships. 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 an actual size of a rectangular parallelepiped according to a rectangular parallelepiped pattern, the method comprising the following steps:
确定所述标准长方体的长、宽、高,分别与所述标准长方体图的长、宽、高的对应关系;Determining, according to the length, width, and height of the standard cuboid, the length, width, and height of the standard cuboid;
根据所述长方体图形中各顶点坐标,确定长方体图形的长、宽、高;Determining a length, a width, and a height of the rectangular parallelepiped graphic according to coordinates of each vertex in the rectangular parallelepiped graphic;
利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的长方体的长、宽、高,并将所确定的长、宽、高输入三维绘图引擎。The length, width, and height of the rectangular parallelepiped corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input to the three-dimensional drawing engine.
其中,标准长方体图形是将标准长方体按指定投影关系投影到二维平面上所形成的图形。标准长方体的长宽高是实际长宽高,标准长方体图的长宽高是图形中三条不同边的长度。 将标准长方体按不同投影关系投影到二维平面上所形成的标准长方体图形的长宽高可能不同。因此,三维绘图引擎需要知道标准长方体的实际长宽高才能绘制不同投影关系下的标准长方体图形。The standard rectangular parallelepiped graphic is a graphic formed by projecting a standard rectangular parallelepiped onto a two-dimensional plane according to a specified projection relationship. The length, width, and height of a standard cuboid are the actual length, width, and height. The length, width, and height of a standard cuboid is the length of three different sides in the graph. The length, width, and height of a standard cuboid pattern formed by projecting a standard cuboid onto a two-dimensional plane in different projection relationships may be different. Therefore, the 3D drawing engine needs to know the actual length, width and height of the standard cuboid to draw standard cuboid graphics in different projection relationships.
在生成第一夹角、第二夹角以及预设绘制方向的过程中,标准长方体的长、宽、高已知,例如,标准长方体的三维尺寸可以设置为X0=Y0=Z0=1。又由于将标准长方体按指定投影关系投影到二维平面上所形成的标准长方体图形的顶点已确定,则可以获得标准长方体图的长、宽、高。例如长为OC,宽为OA,高为BD。因此,可以确定标准长方体的长、宽、高,分别与标准长方体图的长、宽、高的对应关系。另外,根据二维平面中长方体图形的各顶点坐标,可以确定长方体图形的长、宽、高,例如长为OC’,宽为OA’,高为B’D’,进而利用对应关系以及长方体图形的长、宽、高,确定长方体图形对应的长方体的长、宽、高,并将所确定的长、宽、高输入三维绘图引擎,从而可以通过三维绘图引擎绘制出不同投影关系下的长方体图形。The length, width, and height of the standard cuboid are known during the generation of the first angle, the second angle, and the preset drawing direction. For example, the three-dimensional size of the standard cuboid can be set to X 0 =Y 0 =Z 0 = 1. Moreover, since the vertices of the standard cuboid pattern formed by projecting the standard cuboid onto the two-dimensional plane according to the specified projection relationship have been determined, the length, width, and height of the standard cuboid map can be obtained. For example, the length is OC, the width is OA, and the height is BD. Therefore, the length, width, and height of the standard cuboid can be determined, respectively, corresponding to the length, width, and height of the standard cuboid. In addition, according to the coordinates of the vertices of the rectangular parallelepiped in the two-dimensional plane, the length, width, and height of the rectangular parallelepiped figure can be determined, for example, the length is OC', the width is OA', the height is B'D', and the correspondence and the rectangular parallelepiped figure are utilized. The length, width, and height of the cuboid are determined by the length, width, and height of the cuboid, and the determined length, width, and height are input into the three-dimensional drawing engine, so that the cuboid graphics under different projection relationships can be drawn by the three-dimensional drawing engine. .
以图2E为例,假设标准长方体的长、宽、高分别为:X0、Z0、Y0,按照指定投影关系将标准长方体投影到二维平面上所形成的标准长方体图形的长、宽、高分别为:OC、OA、BD,假设长方体的长、宽、高分别为:X、Z、Y,按照所述指定投影关系将长方体投影到二维平面上所形成的长方体图形的长、宽、高分别为:OC'、OA'、B'D',采用以下公式可以获得X、Y、Z:Taking FIG. 2E as an example, assume that the length, width, and height of the standard rectangular parallelepiped are: X 0 , Z 0 , and Y 0 , and the length and width of the standard rectangular parallelepiped pattern formed by projecting the standard rectangular parallelepiped onto the two-dimensional plane according to the specified projection relationship. The heights are: OC, OA, and BD. It is assumed that the length, width, and height of the rectangular parallelepiped are: X, Z, and Y, and the length of the rectangular parallelepiped formed by projecting the rectangular parallelepiped onto the two-dimensional plane according to the specified projection relationship. The width and height are: OC', OA', B'D', and X, Y, Z can be obtained by the following formula:
Figure PCTCN2017104850-appb-000007
Figure PCTCN2017104850-appb-000007
Figure PCTCN2017104850-appb-000008
Figure PCTCN2017104850-appb-000008
Figure PCTCN2017104850-appb-000009
Figure PCTCN2017104850-appb-000009
其中,由于预设绘制方向为y轴的负方向,则B'D'=|P3.Y-P2.Y|。Wherein, since the preset drawing direction is the negative direction of the y-axis, B'D'=|P3.Y-P2.Y|.
可见,可以根据绘制的长方体图形,确定长方体图形所对应的实际长方体的尺寸,即三维绘图引擎所需的三维尺寸,进而利用三维绘图引擎绘制长方体图形。具体的,可以利用二维绘图引擎或者自制的二维绘图工具绘制二维平面中的长方体图形(即执行步骤201至步骤204),在确定所绘制长方体图形所对应的长方体在三维绘图引擎中的三维尺寸后,可以将已绘制的长方体图擦除,将三维尺寸传给三维绘图引擎,利用三维绘图引擎绘制新的长方 体图形,并且支持长方体图形的转动。It can be seen that the size of the actual cuboid corresponding to the cuboid figure, that is, the three-dimensional size required by the three-dimensional drawing engine, can be determined according to the drawn rectangular parallelepiped figure, and then the cuboid figure is drawn by the three-dimensional drawing engine. Specifically, the two-dimensional drawing engine or the self-made two-dimensional drawing tool can be used to draw the rectangular parallelepiped figure in the two-dimensional plane (ie, step 201 to step 204 are performed), and the cuboid corresponding to the drawn rectangular parallelepiped figure is determined in the three-dimensional drawing engine. After 3D size, you can erase the drawn cuboid image, pass the 3D size to the 3D drawing engine, and draw a new rectangle with the 3D drawing engine. Body graphics, and support the rotation of the cuboid graphics.
如图2F所示,图2F是本发明根据一示例性实施例示出的另一种图形绘制示意图。由于第一点到最终的第二点、最终的第二点到最终的第三点、以及转动,展示出来的图呈现动态效果,为了示意方便,图2F仅列举了七个状态进行示例说明。在绘图过程中,用户点击的第一个点作为第一点,以第一点为起点进行移动,移动轨迹中任何一点均为第二点,针对每个当前的第二点均动态绘制相应的目标面,图2F以其中一个点为例进行示例说明,如动态绘制获得图2F中状态二所示的目标面。当接收到确认指令时,将当前绘制的目标面确定为最终的目标面,如图2F中的状态三所示。然后,以第二点为起点进行移动,移动轨迹中任何一点均为第三点,针对每个当前的第三点均动态绘制相应的长方体图形,当接收到确认指令时,将当前绘制的长方体图形确定为最终的长方体图形,如图2F中状态四所示的长方体图形。根据计算可以获得该长方体图形所对应的长方体在三维绘图引擎中的三维尺寸,将三维尺寸传给三维绘图引擎,利用三维绘图引擎绘制新的长方体图形,并且支持长方体图形的转动。图2E示出三种转动示意图,如状态五、状态六、状态七。由于长方体在三维绘图引擎中的三维尺寸确定,因此转动长方体时,可以展示将长方体按不同投影关系投影到二维平面上所形成的长方体图形。FIG. 2F is a schematic diagram showing another drawing according to an exemplary embodiment of the present invention. Since the first point to the final second point, the final second point to the final third point, and the rotation, the displayed figure exhibits a dynamic effect, and for the convenience of illustration, FIG. 2F exemplifies only seven states. During the drawing process, the first point clicked by the user is taken as the first point, and the first point is used as the starting point to move, and any point in the moving track is the second point, and the corresponding second point is dynamically drawn for each current second point. The target surface, FIG. 2F is exemplified by taking one of the points as an example, such as dynamic drawing to obtain the target surface shown in the second state in FIG. 2F. When the confirmation command is received, the currently drawn target surface is determined as the final target surface, as shown in state three in FIG. 2F. Then, moving from the second point as a starting point, any point in the moving track is the third point, and the corresponding cuboid figure is dynamically drawn for each current third point, and when the confirmation instruction is received, the currently drawn cuboid is drawn. The graphic is determined as the final cuboid pattern, as shown in the state of Figure 4F in the cuboid pattern. According to the calculation, the three-dimensional size of the rectangular parallelepiped corresponding to the cuboid graphic in the three-dimensional drawing engine can be obtained, the three-dimensional size is transmitted to the three-dimensional drawing engine, the new rectangular parallelepiped graphic is drawn by the three-dimensional drawing engine, and the rotation of the rectangular parallelepiped graphic is supported. Figure 2E shows three rotation diagrams, such as state five, state six, and state seven. Since the three-dimensional size of the cuboid in the three-dimensional drawing engine is determined, when the rectangular parallelepiped is rotated, a rectangular parallelepiped figure formed by projecting the rectangular parallelepiped into a two-dimensional plane according to different projection relationships can be displayed.
以上实施例中的各种技术特征可以任意进行组合,只要特征之间的组合不存在冲突或矛盾,但是限于篇幅,未进行一一描述,因此上述实施方式中的各种技术特征的任意进行组合也属于本说明书公开的范围。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.
如图3所示,图3是本发明根据一示例性实施例示出的另一种图形绘制方法的流程图,该方法包括以下步骤:As shown in FIG. 3, FIG. 3 is a flowchart of another graphic drawing method according to an exemplary embodiment of the present invention, and the method includes the following steps:
在步骤301中,获取第一点坐标,获取第二点坐标。In step 301, the first point coordinates are acquired, and the second point coordinates are acquired.
在步骤302中,将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角确定另一对对角顶点的坐标,根据所获得的坐标绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角。In step 302, the first point coordinate and the second point coordinate are used as coordinates of a pair of diagonal vertices, and the coordinates of the other pair of diagonal vertices are determined according to the preset first angle and the second angle. And drawing a target surface of the rectangular parallelepiped figure according to the obtained coordinates, where the second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped image, and the first angle is the preset The angle between one edge of the face and one axis of the preset two-dimensional coordinate system in the two-dimensional plane.
在步骤303中,获取第三点坐标。In step 303, the third point coordinates are acquired.
在步骤304中,基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,获得长方体图形中其他四个顶点坐标,并绘制所述长方体图形的其他面。In step 304, based on the second point coordinates, the third point coordinates, and the preset drawing direction, the other four vertex coordinates in the cuboid figure are obtained, and other faces of the cuboid figure are drawn.
在步骤305中,根据所述长方体图形中各顶点坐标,确定长方体图形的长、宽、高。 In step 305, the length, width, and height of the rectangular parallelepiped pattern are determined according to the coordinates of the vertices in the rectangular parallelepiped pattern.
在步骤306中,利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的长方体的长、宽、高,并将所确定的长、宽、高输入三维绘图引擎。In step 306, the length, width, and height of the cuboid corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input into a three-dimensional drawing. engine.
其中,所述对应关系为标准长方体的长与标准长方体图的长的关系、标准长方体的宽与标准长方体图的宽的关系、标准长方体的高与标准长方体图的高的关系,所述标准长方体图是将标准长方体按指定投影关系投影到二维平面上所形成的图形。The correspondence relationship is a relationship between a length of a standard cuboid and a standard cuboid, a relationship between a width of a standard cuboid and a standard cuboid, a relationship between a height of a standard cuboid and a standard cuboid, and the standard cuboid A graph is a graph formed by projecting a standard cuboid onto a two-dimensional plane in a specified projection relationship.
由上述实施例可见,本实施例通过两点绘制长方体图形的一个面,并通过第三点绘制长方体图形的其他五个面,从而实现长方体图形的绘制,由于用户可以通过两点控制长方体图形的长和宽,通过第三个点控制长方体图形的高,因此可以积极响应绘图指令,绘制出用户期望绘制的长方体图形,进而提高绘制长方体图形的准确性。并且,根据绘制的长方体图形可以获得长方体的三维尺寸,并将三维尺寸传输至三维绘图引擎,通过三维绘图引擎绘制该长方体各种投影关系下的长方体图形,实现二维绘图工具和三维绘图引擎的结合。It can be seen from the above embodiment that the present embodiment draws one face of the rectangular parallelepiped figure by two points, and draws the other five faces of the rectangular parallelepiped figure through the third point, thereby realizing the drawing of the rectangular parallelepiped figure, because the user can control the rectangular parallelepiped figure through two points. The length and width control the height of the cuboid figure through the third point, so the drawing instruction can be actively responded to draw the cuboid figure that the user desires to draw, thereby improving the accuracy of drawing the cuboid figure. Moreover, according to the drawn rectangular parallelepiped figure, the three-dimensional size of the rectangular parallelepiped can be obtained, and the three-dimensional size is transmitted to the three-dimensional drawing engine, and the rectangular parallelepiped graphic under the various projection relationships of the rectangular parallelepiped is drawn by the three-dimensional drawing engine, thereby realizing the two-dimensional drawing tool and the three-dimensional drawing engine. Combine.
与前述图形绘制方法的实施例相对应,本发明还提供了图形绘制装置、装置所应用的电子设备以及计算存储介质的实施例。Corresponding to the foregoing embodiment of the graphics rendering method, the present invention also provides a graphics rendering apparatus, an electronic device to which the apparatus is applied, and an embodiment of a computing storage medium.
如图4所示,图4是本发明根据一示例性实施例示出的一种图形绘制装置的框图,所述装置包括:As shown in FIG. 4, FIG. 4 is a block diagram of a graphics rendering apparatus according to an exemplary embodiment of the present invention, the apparatus includes:
坐标获取模块410,用于获取第一点坐标;获取第二点坐标;获取第三点坐标;The coordinate acquiring module 410 is configured to acquire first coordinate coordinates, acquire second coordinate coordinates, and acquire third coordinate coordinates;
图形绘制模块420,用于将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面;a graphic drawing module 420, configured to use the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and draw a target surface of the rectangular parallelepiped figure according to the preset first angle and the second angle, based on Drawing the second point coordinate, the third point coordinate, and the preset drawing direction to draw other faces of the rectangular parallelepiped graphic;
其中,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。The second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped, and the first angle is one of the preset surface and the two-dimensional plane An angle of one axis of the two-dimensional coordinate system is set, and the preset drawing direction is a direction of an edge of the standard rectangular parallelepiped that is connected to the preset surface.
在一个可选的实现方式中,所述标准长方体图是将标准长方体按照指定投影关系投影到二维平面上的投影图形,所述第一夹角、第二夹角以及预设绘制方向基于所述指定投影关系获得,所述指定投影关系包括标准长方体的放置角度、标准长方体与投影设备的距离、投影方向以及投影方式。In an optional implementation manner, the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, and the first angle, the second angle, and a preset drawing direction are based on The specified projection relationship is obtained, and the specified projection relationship includes a placement angle of a standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
在一个可选的实现方式中,所述装置还包括参数确定模块,用于:In an optional implementation, the apparatus further includes a parameter determining module, configured to:
在按照指定投影关系将标准长方体从三维空间投影到二维平面时,获取所述标准长方 体各顶点的三维坐标;Obtaining the standard rectangular when projecting a standard cuboid from a three-dimensional space to a two-dimensional plane according to a specified projection relationship The three-dimensional coordinates of the vertices of the body;
基于所述指定投影关系下三维空间到二维平面的投影矩阵,将各顶点的三维坐标转换为相应顶点在预设二维坐标系上的二维坐标,根据所述二维坐标确定二维平面中的标准长方体图;And transforming the three-dimensional coordinates of each vertex into two-dimensional coordinates of the corresponding vertex on a preset two-dimensional coordinate system according to the projection matrix of the three-dimensional space to the two-dimensional plane in the specified projection relationship, and determining the two-dimensional plane according to the two-dimensional coordinates Standard cuboid in the middle;
将所述标准长方体图中预设面的一条边,与所述预设二维坐标系中一轴的夹角确定为第一夹角,将所述预设面中两条相邻边的夹角确定为第二夹角,以及将所述标准长方体图中与所述预设面相连的棱的方向确定为所述预设绘制方向。Determining an edge of the preset surface in the standard cuboid image with an axis of the predetermined two-dimensional coordinate system as a first angle, and clamping the two adjacent sides of the preset surface The angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
在一个可选的实现方式中,所述图形绘制模块420,具体用于:In an optional implementation, the graphic drawing module 420 is specifically configured to:
获取新二维坐标系,所述新二维坐标系与所述预设二维坐标系的原点相同、且所述新二维坐标系与所述预设二维坐标系相应轴的夹角为第一夹角;Obtaining a new two-dimensional coordinate system, the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
基于预设二维坐标系到新二维坐标系的变换矩阵,将预设二维坐标系中所述第一点坐标和第二点坐标变换到新二维坐标系,获得新二维坐标系下的第一点新坐标和第二点新坐标;Based on the transformation matrix of the preset two-dimensional coordinate system to the new two-dimensional coordinate system, the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system are transformed into a new two-dimensional coordinate system to obtain a new two-dimensional coordinate system. The first point of the new coordinate and the second point of the new coordinate;
根据所述第一点新坐标、第二点新坐标以及预设的第二夹角,确定另一对对角顶点在新二维坐标系中的坐标;Determining coordinates of another pair of diagonal vertices in a new two-dimensional coordinate system according to the first point new coordinate, the second point new coordinate, and the preset second angle;
根据两对对角顶点的坐标绘制长方体图形的目标面。The target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
在一个可选的实现方式中,所述装置还包括:In an optional implementation, the apparatus further includes:
三维尺寸确定模块,用于确定所述标准长方体的长、宽、高,分别与所述标准长方体图的长、宽、高的对应关系;根据所述长方体图形中各顶点坐标,确定所述长方体图形的长、宽、高;利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的长方体的长、宽、高;a three-dimensional size determining module, configured to determine a length, a width, and a height of the standard cuboid, respectively corresponding to a length, a width, and a height of the standard cuboid figure; determining the cuboid according to coordinates of each vertex in the cuboid figure Length, width, and height of the graphic; determining the length, width, and height of the rectangular parallelepiped corresponding to the rectangular parallelepiped figure by using the correspondence relationship and the length, width, and height of the rectangular parallelepiped graphic;
信息传输模块,用于将所确定的长、宽、高输入三维绘图引擎。An information transmission module for inputting the determined length, width, and height into the three-dimensional drawing engine.
上述装置中各个模块的功能和作用的实现过程具体详情见上述方法中对应步骤的实现过程,在此不再赘述。For details of the implementation process of the functions and functions of the modules in the foregoing devices, refer to the implementation process of the corresponding steps in the foregoing methods, and details are not described herein again.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本发明方案的目的。本领域普通技术人员在不付出创造性劳 动的情况下,即可以理解并实施。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 are not creative In the case of action, it can be understood and implemented.
相应的,本发明还提供一种电子设备,所述设备包括有处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:Correspondingly, 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:
获取第一点坐标;获取第二点坐标;获取第三点坐标;Obtaining the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the second angle to draw a target surface of the rectangular parallelepiped, the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
相应的,本申请实施例还提供一种计算机存储介质,所述存储介质中存储有程序指令,所述程序指令包括:Correspondingly, the embodiment of the present application further provides a computer storage medium, where the storage medium stores program instructions, where the program instructions include:
获取第一点坐标;获取第二点坐标;获取第三点坐标;Obtaining the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the second angle to draw a target surface of the rectangular parallelepiped, the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
本申请可采用在一个或多个其中包含有程序代码的存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机可用存储介质包括永久性和非永久性、可移动和非可移动媒体,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括但不限于:相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。 The application can 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 includes 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.
如图5所示,图5是根据一示例性实施例示出的一种用于图形绘制的装置500的框图。As shown in FIG. 5, FIG. 5 is a block diagram of an apparatus 500 for graphics rendering, according to an exemplary embodiment.
例如,装置500可以被提供为计算机。参照图5,装置500包括处理组件522,其进一步包括一个或多个处理器,以及由存储器532所代表的存储器资源,用于存储可由处理部件522的执行的指令,例如应用程序。存储器532中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件522被配置为执行指令,以执行上述图形绘制方法。For example, device 500 can be provided as a computer. Referring to FIG. 5, apparatus 500 includes a processing component 522 that further includes one or more processors, and memory resources represented by memory 532 for storing instructions executable by processing component 522, such as an application. An application stored in memory 532 can include one or more modules each corresponding to a set of instructions. Additionally, processing component 522 is configured to execute instructions to perform the graphics rendering method described above.
装置500还可以包括一个电源组件526被配置为执行装置500的电源管理,一个有线或无线网络接口550被配置为将装置500连接到网络,和一个输入输出(I/O)接口558。装置500可以操作基于存储在存储器532的操作系统。 Apparatus 500 can also include a power supply component 526 configured to perform power management of apparatus 500, a wired or wireless network interface 550 configured to connect apparatus 500 to the network, and an input/output (I/O) interface 558. Device 500 can operate based on an operating system stored in memory 532.
其中,当所述存储器532中的指令由所述处理组件522执行时,使得装置500能够执行一种图形绘制方法,包括:Wherein, when the instructions in the memory 532 are executed by the processing component 522, the apparatus 500 is enabled to perform a graphics rendering method, including:
获取第一点坐标;获取第二点坐标;获取第三点坐标;Obtaining the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the second angle to draw a target surface of the rectangular parallelepiped, the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the present disclosure will be apparent to those skilled in the <RTIgt; The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure, which are in accordance with the general principles of the present disclosure and include common general knowledge or conventional technical means in the art that are not disclosed in the present disclosure. . The specification and examples are to be regarded as illustrative only,
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It is to be understood that the invention is not limited to the details of the details and The scope of the disclosure is to be limited only by the appended claims.
以上所述仅为本公开的较佳实施例而已,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。 The above description is only the preferred embodiment of the present disclosure, and is not intended to limit the disclosure, and any modifications, equivalents, improvements, etc., which are made within the spirit and principles of the present disclosure, should be included in the present disclosure. Within the scope of protection.

Claims (10)

  1. 一种图形绘制方法,其特征在于,所述方法包括:A graphic drawing method, the method comprising:
    获取第一点坐标;获取第二点坐标;获取第三点坐标;Obtaining the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
    将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the second angle to draw a target surface of the rectangular parallelepiped, the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
    基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
  2. 根据权利要求1所述的方法,其特征在于,所述标准长方体图是将标准长方体按照指定投影关系投影到二维平面上的投影图形,所述第一夹角、第二夹角以及预设绘制方向基于所述指定投影关系获得,所述指定投影关系包括标准长方体的放置角度、标准长方体与投影设备的距离、投影方向以及投影方式。The method according to claim 1, wherein the standard cuboid map is a projection graph that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, the first angle, the second angle, and a preset. The drawing direction is obtained based on the specified projection relationship including a placement angle of the standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
  3. 根据权利要求2所述的方法,其特征在于,获得所述第一夹角、第二夹角以及预设绘制方向的步骤包括:The method according to claim 2, wherein the step of obtaining the first angle, the second angle, and the preset drawing direction comprises:
    在按照指定投影关系将标准长方体从三维空间投影到二维平面时,获取所述标准长方体各顶点的三维坐标;Obtaining three-dimensional coordinates of each vertex of the standard cuboid when projecting a standard cuboid from a three-dimensional space to a two-dimensional plane according to a specified projection relationship;
    基于所述指定投影关系下三维空间到二维平面的投影矩阵,将各顶点的三维坐标转换为相应顶点在预设二维坐标系上的二维坐标,根据所述二维坐标确定二维平面中的标准长方体图;And transforming the three-dimensional coordinates of each vertex into two-dimensional coordinates of the corresponding vertex on a preset two-dimensional coordinate system according to the projection matrix of the three-dimensional space to the two-dimensional plane in the specified projection relationship, and determining the two-dimensional plane according to the two-dimensional coordinates Standard cuboid in the middle;
    将所述标准长方体图中预设面的一条边,与所述预设二维坐标系中一轴的夹角确定为第一夹角,将所述预设面中两条相邻边的夹角确定为第二夹角,以及将所述标准长方体图中与所述预设面相连的棱的方向确定为所述预设绘制方向。Determining an edge of the preset surface in the standard cuboid image with an axis of the predetermined two-dimensional coordinate system as a first angle, and clamping the two adjacent sides of the preset surface The angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
  4. 根据权利要求1所述的方法,其特征在于,所述结合预设的第一夹角和第二夹角绘制长方体图形的目标面,包括:The method according to claim 1, wherein the drawing the target face of the rectangular parallelepiped figure in combination with the preset first angle and the second angle comprises:
    获取新二维坐标系,所述新二维坐标系与所述预设二维坐标系的原点相同、且所述新二维坐标系与所述预设二维坐标系相应轴的夹角为第一夹角;Obtaining a new two-dimensional coordinate system, the new two-dimensional coordinate system is the same as the origin of the preset two-dimensional coordinate system, and the angle between the new two-dimensional coordinate system and the corresponding axis of the preset two-dimensional coordinate system is First angle;
    基于预设二维坐标系到新二维坐标系的变换矩阵,将所述预设二维坐标系中所述第一点坐标和第二点坐标变换到所述新二维坐标系,获得所述新二维坐标系下的第一点新坐标和第二点新坐标;Converting the first point coordinate and the second point coordinate in the preset two-dimensional coordinate system to the new two-dimensional coordinate system based on a transformation matrix of a preset two-dimensional coordinate system to a new two-dimensional coordinate system, and obtaining a The first point new coordinate and the second point new coordinate in the new two-dimensional coordinate system;
    根据所述第一点新坐标、第二点新坐标以及预设的第二夹角,确定另一对对角顶点在所述新二维坐标系中的坐标; Determining coordinates of another pair of diagonal vertices in the new two-dimensional coordinate system according to the first point new coordinate, the second point new coordinate, and the preset second angle;
    根据两对对角顶点的坐标绘制长方体图形的目标面。The target surface of the cuboid graphic is drawn according to the coordinates of the two pairs of diagonal vertices.
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 4, further comprising:
    确定所述标准长方体的长、宽、高,分别与所述标准长方体图的长、宽、高的对应关系;Determining, according to the length, width, and height of the standard cuboid, the length, width, and height of the standard cuboid;
    根据所述长方体图形中各顶点坐标,确定所述长方体图形的长、宽、高;Determining, according to coordinates of each vertex in the rectangular parallelepiped figure, length, width, and height of the rectangular parallelepiped graphic;
    利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的长方体的长、宽、高,并将所确定的长、宽、高输入三维绘图引擎。The length, width, and height of the rectangular parallelepiped corresponding to the cuboid figure are determined by using the correspondence relationship and the length, width, and height of the cuboid figure, and the determined length, width, and height are input to the three-dimensional drawing engine.
  6. 一种图形绘制装置,其特征在于,所述装置包括:A graphics drawing device, characterized in that the device comprises:
    坐标获取模块,用于获取第一点坐标;获取第二点坐标;获取第三点坐标;a coordinate acquiring module, configured to acquire a first point coordinate; acquire a second point coordinate; and acquire a third point coordinate;
    图形绘制模块,用于将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面;a graphic drawing module, configured to use the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and draw a target surface of the rectangular parallelepiped figure according to the preset first angle and the second angle, based on Depicting the second point coordinate, the third point coordinate, and the preset drawing direction, and drawing other faces of the rectangular parallelepiped graphic;
    其中,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。The second angle is an angle between two adjacent sides in the preset surface in the preset standard rectangular parallelepiped, and the first angle is one of the preset surface and the two-dimensional plane An angle of one axis of the two-dimensional coordinate system is set, and the preset drawing direction is a direction of an edge of the standard rectangular parallelepiped that is connected to the preset surface.
  7. 根据权利要求6所述的装置,其特征在于,所述标准长方体图是将标准长方体按照指定投影关系投影到二维平面上的投影图形,所述第一夹角、第二夹角以及预设绘制方向基于所述指定投影关系获得,所述指定投影关系包括标准长方体的放置角度、标准长方体与投影设备的距离、投影方向以及投影方式。The apparatus according to claim 6, wherein the standard cuboid image is a projection image that projects a standard cuboid onto a two-dimensional plane according to a specified projection relationship, the first angle, the second angle, and a preset. The drawing direction is obtained based on the specified projection relationship including a placement angle of the standard cuboid, a distance between the standard cuboid and the projection device, a projection direction, and a projection manner.
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括参数确定模块,用于:The device according to claim 7, wherein the device further comprises a parameter determining module, configured to:
    在按照指定投影关系将标准长方体从三维空间投影到二维平面时,获取所述标准长方体各顶点的三维坐标;Obtaining three-dimensional coordinates of each vertex of the standard cuboid when projecting a standard cuboid from a three-dimensional space to a two-dimensional plane according to a specified projection relationship;
    基于所述指定投影关系下三维空间到二维平面的投影矩阵,将各顶点的三维坐标转换为相应顶点在预设二维坐标系上的二维坐标,根据所述二维坐标确定二维平面中的标准长方体图;And transforming the three-dimensional coordinates of each vertex into two-dimensional coordinates of the corresponding vertex on a preset two-dimensional coordinate system according to the projection matrix of the three-dimensional space to the two-dimensional plane in the specified projection relationship, and determining the two-dimensional plane according to the two-dimensional coordinates Standard cuboid in the middle;
    将所述标准长方体图中预设面的一条边,与所述预设二维坐标系中一轴的夹角确定为第一夹角,将所述预设面中两条相邻边的夹角确定为第二夹角,以及将所述标准长方体图中与所述预设面相连的棱的方向确定为所述预设绘制方向。Determining an edge of the preset surface in the standard cuboid image with an axis of the predetermined two-dimensional coordinate system as a first angle, and clamping the two adjacent sides of the preset surface The angle is determined to be a second angle, and a direction of an edge of the standard cuboid map connected to the preset surface is determined as the preset drawing direction.
  9. 根据权利要求6至8任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 6 to 8, wherein the device further comprises:
    三维尺寸确定模块,用于确定所述标准长方体的长、宽、高,分别与所述标准长方体图的长、宽、高的对应关系;根据所述长方体图形中各顶点坐标,确定所述长方体图形的长、宽、高;利用所述对应关系以及所述长方体图形的长、宽、高,确定所述长方体图形对应的 长方体的长、宽、高;a three-dimensional size determining module, configured to determine a length, a width, and a height of the standard cuboid, respectively corresponding to a length, a width, and a height of the standard cuboid figure; determining the cuboid according to coordinates of each vertex in the cuboid figure Length, width, and height of the graphic; determining, by using the correspondence relationship and the length, width, and height of the rectangular parallelepiped figure, corresponding to the rectangular parallelepiped graphic The length, width, and height of the cuboid;
    信息传输模块,用于将所确定的长、宽、高输入三维绘图引擎。An information transmission module for inputting the determined length, width, and height into the three-dimensional drawing engine.
  10. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;a memory for storing processor executable instructions;
    其中,所述处理器被配置为:Wherein the processor is configured to:
    获取第一点坐标;获取第二点坐标;获取第三点坐标;Obtaining the coordinates of the first point; acquiring the coordinates of the second point; acquiring the coordinates of the third point;
    将所述第一点坐标和第二点坐标作为一对对角顶点的坐标,并结合预设的第一夹角和第二夹角绘制长方体图形的目标面,所述第二夹角为预设的标准长方体图中预设面内两条相邻边的夹角,所述第一夹角为所述预设面中一条边与二维平面中预设二维坐标系的一轴的夹角;Taking the first point coordinate and the second point coordinate as coordinates of a pair of diagonal vertices, and combining the preset first angle and the second angle to draw a target surface of the rectangular parallelepiped, the second angle is pre The angle between two adjacent sides in the preset surface in the standard rectangular parallelepiped image, the first angle is a clip of one side of the preset surface and one axis of the preset two-dimensional coordinate system in the two-dimensional plane angle;
    基于所述第二点坐标、所述第三点坐标、以及预设绘制方向,绘制所述长方体图形的其他面,所述预设绘制方向为所述标准长方体图中与预设面相连的棱的方向。 And drawing other faces of the cuboid figure based on the second point coordinates, the third point coordinates, and a preset drawing direction, where the preset drawing direction is an edge connected to the preset surface in the standard cuboid figure The direction.
PCT/CN2017/104850 2017-05-11 2017-09-30 Graphic drawing method, apparatus and device WO2018205493A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710331067.7A CN107230239A (en) 2017-05-11 2017-05-11 Pattern drawing method, device and equipment
CN201710331067.7 2017-05-11

Publications (1)

Publication Number Publication Date
WO2018205493A1 true WO2018205493A1 (en) 2018-11-15

Family

ID=59933294

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/104850 WO2018205493A1 (en) 2017-05-11 2017-09-30 Graphic drawing method, apparatus and device

Country Status (2)

Country Link
CN (1) CN107230239A (en)
WO (1) WO2018205493A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114529706A (en) * 2022-04-22 2022-05-24 三一筑工科技股份有限公司 Method, device, equipment and medium for splitting target object in three-dimensional model

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
CN107978018B (en) * 2017-12-22 2022-07-05 广州视源电子科技股份有限公司 Method and device for constructing three-dimensional graph model, electronic equipment and storage medium
CN110084893B (en) * 2019-04-15 2023-05-26 广联达科技股份有限公司 Method and device for two-dimensional and three-dimensional hybrid editing
CN111488655B (en) * 2020-03-13 2023-06-02 上海外高桥造船有限公司 Corner hole drawing method and system
CN112489157B (en) * 2020-12-18 2024-03-19 广州视源电子科技股份有限公司 Photo frame drawing method, device and storage medium
CN113689523A (en) * 2021-08-26 2021-11-23 联想(北京)有限公司 Graph drawing method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147926A (en) * 2011-01-17 2011-08-10 中兴通讯股份有限公司 Three-dimensional (3D) icon processing method and device and mobile terminal
CN105279796A (en) * 2015-10-10 2016-01-27 苏州工业园区凌志软件股份有限公司 Method and device for drawing 3D column chart
CN106600664A (en) * 2016-12-08 2017-04-26 广州视源电子科技股份有限公司 Symmetric figure drawing method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1206614C (en) * 2002-07-19 2005-06-15 章新苏 Device for drawing 3D graphics
CN102044084A (en) * 2009-10-22 2011-05-04 上海杉达学院 Two-dimensional plane expression method of three-dimensional graph
CN103247064B (en) * 2012-02-14 2016-03-30 中国移动通信集团公司 A kind of generation method of three-dimensional dynamic graphical, device and mobile terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147926A (en) * 2011-01-17 2011-08-10 中兴通讯股份有限公司 Three-dimensional (3D) icon processing method and device and mobile terminal
CN105279796A (en) * 2015-10-10 2016-01-27 苏州工业园区凌志软件股份有限公司 Method and device for drawing 3D column chart
CN106600664A (en) * 2016-12-08 2017-04-26 广州视源电子科技股份有限公司 Symmetric figure drawing method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
XIAGUANG TECHNOLOGY: "Basic Course of AutoCAD 2007 Mechanical Drafting", AUTOCAD 2007, 31 January 2008 (2008-01-31), pages 170 - 172 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114529706A (en) * 2022-04-22 2022-05-24 三一筑工科技股份有限公司 Method, device, equipment and medium for splitting target object in three-dimensional model
CN114529706B (en) * 2022-04-22 2022-07-08 三一筑工科技股份有限公司 Method, device, equipment and medium for splitting target object in three-dimensional model

Also Published As

Publication number Publication date
CN107230239A (en) 2017-10-03

Similar Documents

Publication Publication Date Title
WO2018205493A1 (en) Graphic drawing method, apparatus and device
US10074217B2 (en) Position identification method and system
WO2019000692A1 (en) Three-dimensional graphic rendering method, apparatus, device, and storage medium
US10318102B2 (en) 3D model generation from 2D images
US9086837B1 (en) Collaboration sessions
CN106971423B (en) Drawing method, device and equipment of cubic graph and storage medium
US20140225894A1 (en) 3d-rendering method and device for logical window
US10649615B2 (en) Control interface for a three-dimensional graphical object
US11087561B2 (en) Three-dimensional sketching in mobile augmented reality
CN114648615B (en) Method, device and equipment for controlling interactive reproduction of target object and storage medium
US10867452B2 (en) System and methods for conversion of 2D assets into 3D graphical scenes
US11250643B2 (en) Method of providing virtual exhibition space using 2.5-dimensionalization
KR20190127367A (en) Method of providing virtual exhibition space for efficient data management
JP2022548608A (en) Method and Related Apparatus for Acquiring Textures of 3D Models
US8438199B1 (en) System and method for identifying and highlighting a graphic element
CN113129362B (en) Method and device for acquiring three-dimensional coordinate data
US20140253552A1 (en) 3D-Consistent 2D Manipulation of Images
CN107992253B (en) Method and device for regulating and controlling display state of combined three-dimensional graph and computer equipment
US20220043555A1 (en) Three-dimensional operations based on planar projections in graphic user interfaces
US11550460B1 (en) Systems for leveraging device orientation to modify visual characteristics of edits
US10755459B2 (en) Object painting through use of perspectives or transfers in a digital medium environment
US20170017370A1 (en) Device and method for processing data
CN115190996A (en) Collaborative document editing using augmented reality
US20140354627A1 (en) Rendering a 3d shape
JP7378865B1 (en) Method and program for generating images of three-dimensional objects

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: 17909156

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 24.03.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17909156

Country of ref document: EP

Kind code of ref document: A1