CN103325132B - A kind of particle emission method and apparatus - Google Patents

A kind of particle emission method and apparatus Download PDF

Info

Publication number
CN103325132B
CN103325132B CN201310215235.8A CN201310215235A CN103325132B CN 103325132 B CN103325132 B CN 103325132B CN 201310215235 A CN201310215235 A CN 201310215235A CN 103325132 B CN103325132 B CN 103325132B
Authority
CN
China
Prior art keywords
particle
angle
transmitting
launch
emitter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310215235.8A
Other languages
Chinese (zh)
Other versions
CN103325132A (en
Inventor
陈伟伟
耿芹
徐韦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Digital Video Beijing Ltd
Original Assignee
China Digital Video Beijing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Digital Video Beijing Ltd filed Critical China Digital Video Beijing Ltd
Priority to CN201310215235.8A priority Critical patent/CN103325132B/en
Publication of CN103325132A publication Critical patent/CN103325132A/en
Application granted granted Critical
Publication of CN103325132B publication Critical patent/CN103325132B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention provides a kind of particle emission method and apparatus.The described method includes: receiving the particle emitter of creation, the particle emitter includes a line segment, end to end multiple not parallel line segments, ellipse or circle;According to the number for the particle emission point for emitting particle on the total length or total angle of the particle emitter, transmitter angle and the particle emitter, the coordinate position of the particle emission point of transmitting current particle is determined;The first launch angle, the direction of the launch and the transmitter angle of transmitting particle according to setting determine that the second launch angle for emitting particle on particle emission point, the direction of the launch include interior transmitting, outer transmitting and inside and outside transmitting;According to the coordinate position of second launch angle and identified particle emission point, emit current particle on the particle emitter.A variety of different types of particle emissions such as line transmitting, oval transmitting, circle transmitting may be implemented in the present invention.

Description

A kind of particle emission method and apparatus
Technical field
The present invention relates to field of Computer Graphics, send out more particularly to a kind of particle emission method and a kind of particle Injection device.
Background technique
Reeves proposes the method that particIe system is fuzzy objective modeling in nineteen eighty-three, and basic thought is fuzzy Object regards the molecular particle cluster of numerous grains as.For single particle, can be displayed as point, striped, sphere or other The point of shape.Each particle all has the attribute of oneself, such as color, shape, size, life cycle and speed.
Particle is emitted by particIe system, and a particIe system is common by a particle emitter and multiple particles influence device It constitutes, i.e., particIe system generates particle effect.
Particle effect is coefficient by many kinds of parameters as a result, parameter is abundanter, and effect is more diversified.Particle emission The effect of device is position, direction, quantity and initial velocity of the particle of control transmitting when generating.After particle generates, by particle The attribute of object controls particle appearance, and the kinetic property of particle determines its state at different times, particle is at any time Between passage and constantly change.
Existing particle emitter type is more single, cannot achieve a variety of differences such as line transmitting, oval transmitting, circle transmitting The particle emission of type.
Summary of the invention
The present invention provides a kind of method and devices of particle emission, to realize that line transmitting, oval transmitting, circle transmitting etc. are more The different types of particle emission of kind.
The present invention provides a kind of particle emission methods, comprising:
The particle emitter of creation is received, the particle emitter includes a line segment, end to end multiple not parallel Line segment, ellipse or circle;
According to emitting grain on the total length or total angle of the particle emitter, transmitter angle and the particle emitter The number of the particle emission point of son determines the coordinate position of the particle emission point of transmitting current particle;
The first launch angle, the direction of the launch and the transmitter angle of transmitting particle according to setting, determine particle emission point Second launch angle of upper transmitting particle, the direction of the launch include interior transmitting, outer transmitting and inside and outside transmitting;
According to the coordinate position of second launch angle and identified particle emission point, on the particle emitter Emit current particle.
Preferably, on the total length or total angle, transmitter angle and particle emitter according to particle emitter Emit particle particle emission point number, determine transmitting current particle particle emission point coordinate position the step of include:
Calculate the total length or total angle of the particle emitter;
By the particle emission for emitting particle on the total length or total angle and the particle emitter of the particle emitter The number of point obtains the relative position of the particle emission point of transmitting current particle;
By the coordinate position of the relative position and the particle emitter, the particle emission point of transmitting current particle is obtained Initial position;
Rotation counterclockwise is carried out to the initial position according to the transmitter angle and obtains the particle emission of transmitting particle The coordinate position of point.
Preferably, if the radiation pattern of the particle emitter is set as a transmitting, the overall length by particle emitter The number for emitting the particle emission point of particle in degree or total angle and particle emitter, obtains the particle emission of transmitting current particle Point relative position the step of include:
The number for emitting the particle emission point of particle on particle emitter is randomly generated, the number of the particle emission point is Less than the emission maximum points purpose positive number of setting;
By the total length or total angle and particle emission point number product and the emission maximum point number quotient, Obtain the relative position of the particle emission point of transmitting current particle.
Preferably, described by the total of particle emitter if the radiation pattern of the particle emitter is set as non-dots transmitting The number for emitting the particle emission point of particle in length or total angle and particle emitter obtains the particle hair of transmitting current particle The step of relative position of exit point includes:
The relative position of the particle emission point of transmitting current particle is randomly generated, the relative position is less than the particle The total length of transmitter or the positive number of total angle.
Preferably, the first launch angle, the direction of the launch and the transmitter angle of the transmitting particle according to setting, determines The step of the second launch angle of transmitting particle, includes: on particle emission point
By the launch angle parameter, transmitting range parameter and the direction of the launch being arranged, first angle of departure of transmitting particle is calculated Degree;
First launch angle is subjected to rotation counterclockwise according to the transmitter angle and obtains the second of transmitting particle Launch angle.
Preferably, the launch angle parameter, transmitting range parameter and the direction of the launch by being arranged calculates transmitting particle The step of first launch angle includes:
When the direction of the launch is interior transmitting, it regard the sum of the launch angle parameter and launch angle adjusted value as institute The first launch angle is stated, the launch angle adjusted value is the positive number less than the transmitting range parameter;
When the direction of the launch is outer transmitting, by the negative value of the sum of the launch angle parameter and launch angle adjusted value As first launch angle, the launch angle adjusted value be generate at random be less than the transmitting range parameter just Number;
When the direction of the launch is inside and outside transmitting, the first launch angle of each particle emission point is set to institute It states the sum of launch angle parameter and launch angle adjusted value and first launch angle is the launch angle parameter and hair The negative value of the sum of firing angle degree adjusted value.
Preferably, when the particle emitter is ellipse or bowlder, the launch angle parameter and transmitting model by being arranged The step of enclosing parameter, calculating the first launch angle of transmitting particle further include:
For the particle emission point on the particle emitter, the tangent line rector and horizontal axis of position are calculated Angle;
First launch angle is rotated counterclockwise according to the angle.
The present invention also provides a kind of particle emission devices, comprising:
Creation module, for receiving the particle emitter of creation, the particle emitter includes a line segment, joins end to end Multiple not parallel line segments, ellipse or circle;
Position determination module, for according to the particle emitter total length or total angle, transmitter angle with it is described The number for emitting the particle emission point of particle on particle emitter determines the coordinate bit of the particle emission point of transmitting current particle It sets;
Angle-determining module, the first launch angle, the direction of the launch and transmitter angle for the transmitting particle according to setting Degree determines that the second launch angle of transmitting particle, the direction of the launch include interior transmitting, outer transmitting and inside and outside transmitting;
Transmitting module, for the coordinate position according to second launch angle and identified particle emission point, in institute State particle emitter transmitting current particle.
Preferably, the position determination module includes:
Computational submodule, for calculating the total length or total angle of the particle emitter;
It is spaced and determines submodule, for the total length or total angle and the particle emitter by the particle emitter The number for emitting the particle emission point of particle obtains the relative position of the particle emission point of transmitting current particle;
Initial position determines submodule, for the coordinate position by the relative position and the particle emitter, obtains Emit the initial position of the particle emission point of current particle;
Coordinate position determines submodule, for being rotated counterclockwise according to the transmitter angle to the initial position Obtain the coordinate position of the particle emission point of transmitting particle.
Preferably, the angle-determining module includes:
Angle calculation submodule calculates hair for the launch angle parameter, transmitting range parameter and the direction of the launch by being arranged First launch angle of radion;
Angle rotates submodule, for being rotated first launch angle counterclockwise according to the transmitter angle Obtain the second launch angle for emitting particle on the particle emission point.
Compared with prior art, the present invention includes the following advantages:
The embodiment of the present invention is first depending on particle total length or total angle after the particle emitter for receiving creation, with And emit the number of the particle emission point of particle on the particle emitter, so that it is determined that the particle emission point of transmitting current particle Coordinate position, then according to setting transmitting particle the first launch angle, the direction of the launch and transmitter angle, determine particle The second launch angle for emitting particle on launch point, finally according to the seat of the launch angle of determining particle emission point and launch point Cursor position emits current particle, can need to select by a line segment, the first connected multiple not parallel lines according to specific Section, oval or circle carry out the transmitting of the different modes such as corresponding line transmitting, oval transmitting, circle transmitting, to be particle emission Provide diversified radiation pattern.
Detailed description of the invention
Fig. 1 is a kind of flow chart of particle emission method described in the embodiment of the present invention;
Fig. 2 is a kind of structural block diagram of particle emission device described in the embodiment of the present invention;
Fig. 3 a-3e is the creation schematic diagram of particle emitter in the embodiment of the present invention;
Fig. 4 a-4b is the ellipse radii adjustment schematic diagram of oval transmitter in the embodiment of the present invention;
Fig. 5 is the schematic diagram that particle emission attribute is arranged in the embodiment of the present invention;
Fig. 6 is the line transmitter schematic diagram that particle emission point number is 8 in the embodiment of the present invention;
Fig. 7a-7c is the effect diagram of not collinear transmitter in the embodiment of the present invention;
Fig. 8 a-8f is the launching effect schematic diagram of oval transmitter in the embodiment of the present invention;
Fig. 9 a-9b is in the embodiment of the present invention to the different postrotational launching effect schematic diagrames of particle emitter;
Figure 10 is the launching effect schematic diagram of the line transmitter of Z-shaped in the embodiment of the present invention.
Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.
It is described in detail below by implementation process of the embodiment to the method for the invention.
Referring to Fig.1, it illustrates a kind of flow charts of particle emission method described in the embodiment of the present invention.
Step 101, the particle emitter for receiving creation, the particle emitter include a line segment, end to end more A not parallel line segment, ellipse or circle.
Particle emitter can control position, direction, quantity and initial velocity of the particle of transmitting when generating.The present invention In embodiment, particle emitter can be created in particle editing software, the link of transmitter can be created by choosing, on boundary The shape of particle emitter is set in face, and it may include one that in embodiments of the present invention, particle emitter, which can be line transmitter, A line segment or end to end multiple not parallel line segments, particle emitter are also possible to oval transmitter or circle transmitter, It may include accordingly an ellipse or a circle.
As illustrated in figs. 3 a-3d, the creation schematic diagram of particle emitter is given, line transmitter is chosen by preset link Afterwards, the endpoint (as shown in Figure 3a) that can click interface creating outlet transmitter draws a line on interface, forms second A endpoint obtains a line segment (as shown in Figure 3b), continues to click interface, be formed third line segment endpoint (as shown in Figure 3c), The 4th line segment endpoint (as shown in Figure 3d) can be further formed by continuing click interface, stopped the operation to interface, can be obtained To the line transmitter of Z-shaped as shown in Figure 3d.
In fig. 3 a, if further selection creation is oval or round, emitter types become oval transmitter, such as Fig. 3 e Show the schematic diagram of oval transmitter.
After creating oval transmitter, it can also be further arranged by transmitter properties and be linked, further setting is oval Property parameters, including elliptical major radius X and short radius Y, in the embodiment of the present invention, the unit of major radius X and short radius Y are Pixel, if Fig. 4 a and Fig. 4 the b ellipse radii for giving in the embodiment of the present invention oval transmitter adjust schematic diagram, half in Fig. 4 a Diameter X is 70 pixels, and radius Y is 58 pixels, and radius X is 191 pixels in Fig. 4 b, and radius Y is 58 pixels.
Similarly, if creation is round transmitter, it can also be further arranged by transmitter properties and be linked, is further arranged Round property parameters, including round radius X.
Step 102, the total length according to the particle emitter or total angle, transmitter angle and the particle emitter The number of the particle emission point of upper transmitting particle, determines the coordinate position of the particle emission point of transmitting current particle.
Have multiple particles launch point on particle emitter, it, can be further according to transmitter category after creating particle emission Property setting link, be arranged particle emitter on particle emission point maximum number (being denoted as numPoint), be illustrated in figure 5 this hair The schematic diagram of particle emission attribute is set in bright embodiment, wherein numPoint 8 gives particle emission point as shown in Figure 6 Number is set as 8 line transmitter schematic diagram.
After creating particle emitter, before emitting particle, it is also necessary to further determine that particle emission on particle emitter The specific location of point and the angle for emitting particle are emitting each grain since particle emitter has certain tranmitting frequency Before son, the specific location for first determining the particle emission point of transmitting particle and the angle for emitting particle are required.
In the embodiment of the present invention, according to the particle hair for emitting particle on the particle emitter and particle emitter of creation The number of exit point may further determine that the coordinate position of each particle emission point on particle emitter.
In the embodiment of the present invention, the step 102 may include:
Sub-step S11, the total length or total angle for calculating the particle emitter;
Sub-step S12, by the particle emitter total length or total angle and the particle emitter on emit particle Particle emission point number, obtain transmitting current particle particle emission point relative position;
Sub-step S13, by the coordinate position of the relative position and the particle emitter, obtain transmitting current particle The initial position of particle emission point;
Sub-step S14, according to the transmitter angle, to initial position progress, rotation obtains transmitting particle counterclockwise Particle emission point coordinate position.
Specifically, the total length or total angle of particle emitter can be calculated first, for line transmitter, calculate The total length of particle emitter, the total length of particle emitter is the summation of the length of each line segment, for oval transmitter Or circle transmitter, the total angle of particle emitter is calculated, the total angle of particle emitter is 2PI, i.e. 2 π=360 degree.
By taking the line transmitter comprising multiple line segments as an example, the length of particle emitter is the length of the broken line of multiple line segments composition Degree, it is assumed that the endpoint of each line segment is respectively point0, point1...pointn on broken line, and the length for calculating broken line is LineLength=sqrt ((pointn.x-pointn-1.x) × (pointn.x-pointn-1.x)+(pointn.y- pointn-1.y)×(pointn.y-pointn-1.y))+...sqrt((point1.x-point0.x)×(point1.x- Point0.x)+(point1.y-point0.y) × (point1.y-point0.y)), i.e., the line segment overall length between each endpoint Degree.
Number according to particle emission point on the total length or total angle and particle emitter of particle emitter can be into one Step obtains the relative position of each particle emission point on particle emitter, further determines that each particle emission point by relative position Specific location.
The radiation pattern of particle emitter includes point transmitting and non-dots transmitting, according to the difference of radiation pattern, determines particle The mode of the relative position of launch point is also different, after creating particle emitter, can be arranged by preset transmitter properties Link, the specific radiation pattern of particle emitter is arranged as point transmitting or non-dots transmitting.The present invention as shown in Figure 5 is implemented It is arranged in the schematic diagram of particle emission attribute in example, can choose particle emission mode.
Specifically, if the radiation pattern of the particle emitter is set as a transmitting, it is flat by distance on transmitter Emit on equal fixed point, particle emitter is subjected to equal part, particle is emitted on Along ent, the sub-step S12 can wrap It includes:
Sub-step S12-1, the number for emitting the particle emission point of particle on particle emitter, the particle hair is randomly generated The number of exit point is the emission maximum points purpose positive number less than setting;
Sub-step S12-2, it is sent out by the product of the number of the total length or total angle and particle emission point with the maximum The quotient of exit point number obtains the relative position of the particle emission point of transmitting current particle.
The radiation pattern of particle emitter can be further selected after creating particle emitter, if radiation pattern is point hair Penetrate (bool bPoint).× maximum number indicates the number of particle emission point position on particle emitter, specifically emits point Setting is calculated when emitting maximum number point position, and the distance between two launch points are LineLength/NumPoint, then Zero to randomly choosed between maximum number particle emission point RandomIndex (RandomIndex range be [0, NumPoint]), it that is to say one particle emission point of selection random selection, the launch point in NumPoint particle emission point Relative position be LengthRatio=(RandomIndex × NumPoint)/LineLength.
For oval or circle transmitter, particle emission can be obtained by the total angle of particle emitter divided by the number The relative position (PosAngle) of each particle emission point on device, PosAngle=2 × (PI/NumPoint) × RandomIndex。
It is further preferred that if the radiation pattern of the particle emitter is set as non-dots transmitting, in particle emitter On any position emitted at random, the sub-step S12 may include:
Sub-step S12-3, the relative position for emitting the particle emission point of current particle is randomly generated, the relative position is Less than the total length of the particle emitter or the positive number of total angle.
If particle emission mode is non-dots transmitting, particle can be randomly choosed in the range of particle emitter total length The particle emission point of transmitter.
For line transmitter, relative position (LengthRatio) is the positive number of the total length less than the particle emitter, Several RandomIndex, LengthRatio=RandomIndex is randomly generated in [0, LineLength] range;For ellipse Round or circle transmitter, relative spacing are the positive number of the total angle less than the particle emitter, i.e., in [0,2PI] range with Machine generates number RandomIndex, PosAngle=RandomIndex.
It, can be further in the case where a radiation pattern or non-dots radiation pattern has been determined behind the relative position of particle emission point According to the coordinate of particle emitter, the initial position of each particle emission point is calculated.
By taking line transmitter as an example, the coordinate of each endpoint is point0, point1...pointn, then further will be each The broken line that endpoint is constituted, calculates the length of every section of broken line and the overall length Sum to starting point since 0, finds relative position place Broken line, meet Sum [i] < relative position < Sum [i+1], the endpoint found is point [i], point [i+1], according to Launch point position meets the principle equal with relative position value of the broken line distance away from broken line head-end, calculates on broken line To initial position initialPos of the particle emission point on particle emitter.Formula is as follows;
InitialPos.x=point [i] .x+ (LengthRatio-Sum [i])/(Sum [i+1]-Sum [i]) * (point[i+1].x-point[i].x);
InitialPos.Y=(point [i+1] .y-point [i] .y)/(point [i+1] .x-point [i] .x) * (point.x-point[i].x)+point[i].y。
By taking oval transmitter as an example, since the coordinate of transmitter is determined (ellipse by elliptical major radius X and short radius Y The coordinate of four endpoints is respectively (X, 0), (- X, 0), (0, Y) and (0 ,-Y)), with relative position PosAngle and radius X, Y meter The initial position position (position.x, position.y) of launch point is calculated, specifically:
Position.x=Math::Cos (PosAngle) × X;
Position.y=Math::Sin (PosAngle) × Y.
For justifying transmitter, since the coordinate of transmitter is determined (the coordinate difference of four endpoints of circle by the radius X justified For (X, 0), (- X, 0), (0, X) and (0 ,-X)), the initial position of launch point is calculated with relative position PosAngle and radius X Position (position.x, position.y), specifically:
Position.x=Math::Cos (PosAngle) × X;
Position.y=Math::Sin (PosAngle) × X.
Due to being also provided with the angle of particle emitter for particle emitter, transmitter angle is to make entire transmitter Rotation, the position including the direction of the launch and transmitting is needed according to Transmitter side to the initial position and hair to particle emission point Direction is penetrated to be adjusted, therefore, after obtaining position of the particle emission point of transmitting current particle on particle emitter, Ke Yijin One step carries out the initial position according to the transmitter angle to rotate the particle emission point for obtaining transmitting particle counterclockwise Coordinate position, coordinate position herein are the final position for emitting particle, are adjusted to initial position as follows:
PX=pParticle- > position.x;
PY=pParticle- > position.y;
PParticle- > position.x=pX × rAngleCos-pY × rAngleSin;
PParticle- > position.y=pX × rAngleSin+pY × rAngleCos;
RX: indicate that temporary variable is the X value in particle emission direction
RY: indicate that temporary variable is the Y value in particle emission direction
RAngleCos: indicate that rAngleCos is the cosine value of transmitter angle
RAngleSin: indicate that rAngleSin is the sine value of transmitter angle
PX: indicate that temporary variable is the X value of particle position
PY: indicate that temporary variable is the Y value of particle position
Step 103, the first launch angle, the direction of the launch and the transmitter angle for emitting particle according to setting, determine grain Emit the second launch angle of particle on sub- launch point, the direction of the launch includes interior transmitting, outer transmitting and inside and outside transmitting.
In the embodiment of the present invention, for the first launch angle and transmitter angle of particle emitter setting, further really Determine the actual transmission angle of particle emitter, i.e. the second launch angle, the step 103 may include:
Sub-step S21, launch angle parameter, transmitting range parameter and the direction of the launch by being arranged calculate transmitting particle First launch angle;
First launch angle is always determined according to launch angle parameter, transmitting range parameter and the launch party of setting, is emitted Direction includes interior transmitting, outer transmitting and inside and outside transmitting.Specifically, link can be arranged (such as by preset transmitter properties Shown in Fig. 5) the launch angle parameter of setting transmitter and transmitting range parameter and the direction of the launch be interior transmitting (bool BIn), outer transmitting (bool bOut) or inside and outside transmitting, it is interior transmitting be according to the direction of the launch direction emit, it is outer transmitting be by According to the opposite direction transmitting of the direction of the launch, inside and outside transmitting is the opposite direction according to the direction of the direction of the launch and the direction of the launch simultaneously Emit simultaneously, selects that interior transmitting and outer transmitting can be chosen when inside and outside transmitting simultaneously.
When transmitting in selection, by the sum of the launch angle parameter and launch angle adjusted value as first transmitting Angle, the launch angle adjusted value are the positive number less than the transmitting range parameter.Specifically, first according to the transmitting Range parameter (directionRange) is randomly generated a launch angle adjusted value, the range of launch angle adjusted value be (0, DirectionRange), wherein if transmitting range parameter is 0, launch angle adjusted value is also 0.First launch angle (particle.direction) it is the sum of launch angle parameter and launch angle adjusted value, can be expressed as Particle.direction=direction+Rand (0, directionRange).As Fig. 7a-7c shows the present invention in fact The effect diagram of not collinear transmitter in example is applied, as shown in Figure 7a, sets 90 degree for the launch angle parameter of line transmitter, Transmitting range parameter is 0, when being set as interior transmitting, obtained launching effect, wherein 90 degree of the first launch angle.
Correspondingly, Fig. 8 a and Fig. 8 b show the launching effect schematic diagram of oval transmitter in the embodiment of the present invention, wherein Launch angle parameter is set as 90 degree, and transmitting range parameter is 0, when being set as interior transmitting, in different background (the 10th frame backgrounds Image and the 20th frame background image) under obtained launching effect.
When selecting outgoing to penetrate, using the negative value of the sum of the launch angle parameter and launch angle adjusted value as described the One launch angle, the launch angle adjusted value are the positive number less than the transmitting range parameter generated at random.Equally, first A launch angle adjusted value, launch angle adjusted value is randomly generated according to the transmitting range parameter (directionRange) Range be (0, directionRange), wherein if transmitting range parameter be 0, launch angle adjusted value is also 0.First Launch angle (particle.direction) is the negative value of the sum of launch angle parameter and launch angle adjusted value, can be indicated For particle.direction=- (direction+Rand (0, directionRange)).As shown in Figure 7b, line is emitted The launch angle parameter of device is set as 90 degree, and transmitting range parameter is 0, when being set as outer transmitting, obtained launching effect, wherein First launch angle -90 degree.
Correspondingly, Fig. 8 c and Fig. 8 d, which are shown, sets 90 degree for the launch angle parameter of oval transmitter, transmitting range Parameter is 0, when being set as outer transmitting, the hair that is obtained under different backgrounds (the 10th frame background image and the 20th frame background image) Penetrate effect.
When transmitting in simultaneous selection and outer transmitting, the first launch angle of particle emission point is set to the hair It penetrates the sum of angle parameter and launch angle adjusted value and first launch angle is the launch angle parameter and the angle of departure Spend the negative value of the sum of adjusted value.Equally, one is randomly generated according to the transmitting range parameter (directionRange) first Launch angle adjusted value, the range of launch angle adjusted value are (0, directionRange), wherein if transmitting range parameter is 0, then launch angle adjusted value is also 0.First launch angle (particle.direction) is launch angle parameter and transmitting The negative value of the sum of angle adjusted value, can be expressed as particle.direction=direction+Rand (0, ) or particle.direction=- (direction+Rand (0, directionRange)) directionRange.Such as figure Shown in 7c, 90 degree are set by the launch angle parameter of line transmitter, transmitting range parameter is 0, when being set as inside and outside transmitting, is obtained The launching effect arrived, wherein the first launch angle 90 or -90 is spent.
Correspondingly, Fig. 8 e and Fig. 8 f, which are shown, sets 90 degree for the launch angle parameter of oval transmitter, transmitting range Parameter is 0, when being set as inside and outside transmitting, is obtained under different backgrounds (the 10th frame background image and the 20th frame background image) Launching effect.
When the particle emitter is that oval or bowlder, the sub-step S21 can further include:
Sub-step S21-4, for the particle emission point on the particle emitter, calculate the tangent line rector of position with The angle of horizontal axis;
Sub-step S21-5, first launch angle is rotated counterclockwise according to the angle.
For round or oval, be all in the point of particle emission it is borderline in oval or circle, due to each particle emission The transverse and longitudinal coordinate value of point is different from, and there are relationship in the direction of the launch of particle and position, therefore, for the first obtained transmitting Angle, it is also necessary to be corrected again according to the direction of the launch of the launch point position to particle.
RX=pParticle- > direction.x;
RY=pParticle- > direction.y;
Wherein, pParticle- > direction is the direction of the launch of particle before acting on by transmitter angle parameter, rX Indicate that temporary variable is the X value in particle emission direction, rY indicates that temporary variable is the Y value in particle emission direction;
Then it is converted as follows, the direction of the launch after being converted:
PParticle- > direction.x=rX × rAngleCos-rY × rAngleSin;
PParticle- > direction.y=rX × rAngleSin+rY × rAngleCos;
Wherein, rAngleCos indicates that the cosine value of tangent line rector and X-axis angle, rAngleSin indicate tangent line rector and X The sine value at axle clamp angle.
By above-mentioned conversion, the tangent line rector of available particle emission point and the angle value of X-axis angle, according to the angle Value rotates the direction of the launch of particle counterclockwise.It is zero direction when the direction of the launch of each point is identical as its tangent line rector, I.e. radiation direction is to rotate to be the transmitting of positive direction counterclockwise using tangent line rector as null vector.
Sub-step S22, according to the transmitter angle, by first launch angle progress, rotation is emitted counterclockwise Second launch angle of particle.
After obtaining the first launch angle, it is also necessary to be adjusted further according to transmitter angle to the first launch angle Whole, particle emitter is finally to emit particle according to the second launch angle.
Transmitter angle is adjusted for the direction to particle emitter, and effect is by particle emitter according to transmitting Device angle is rotated counterclockwise.
Specifically, if line transmitter includes multiple line segments, needing to calculate particle hair when rotating to line transmitter Angle of the line segment before rotation with horizontal axis X-axis where exit point, specifically, calculating particle hair first, in accordance with following formula The angle of the vector and X-axis of the starting point mVertexArray [i] Dao terminal mVertexArray [i+1] of line segment where exit point Cos and sin:
RDistance=sqrt ((mVertexArray [i+1] .x-mVertexArray [i] .x) × (mVertexArray[i+1].x-mVertexArray[i].x)+(mVertexArray[i+1].y-mVertexArray[i] .y)×(mVertex Array[i+1].y-mVertexArray[i].y));
RAngleCos=(mVertexArray [i+1] .x-mVertexArray [i] .x)/rDistance;
RAngleSin=(mVertexArray [i+1] .y-mVertexArray [i] .y)/rDistance;
Wherein:
MVertexArray: the line endpoints array of line transmitter is indicated
RDistance: indicate that mVertexArray [i] arrives the distance of mVertexArray [i+1]
RAngleCos: the cosine value of line vector and X-axis angle is indicated
RAngleSin: the sine value of line vector and X-axis angle is indicated
By being converted as follows, realizes and revolving expeller angle value counterclockwise is carried out to the direction of the launch, obtain practical hair Penetrate direction:
RX=pParticle- > direction.x;
RY=pParticle- > direction.y;
PParticle- > direction.x=rX × rAngleCos-rY × rAngleSin;
PParticle- > direction.y=rX × rAngleSin+rY × rAngleCos;
Wherein, pParticle- > direction is the direction of the launch of particle before acting on by transmitter angle parameter, rX Indicate that temporary variable is the X value in particle emission direction, rY indicates that temporary variable is the Y value in particle emission direction, and rAngleCos is The cosine value of transmitter angle, rAngleSin are the sine value of transmitter angle.
Similarly, when being rotated to oval transmitter, it is also desirable to carry out revolving expeller angle counterclockwise to the direction of the launch Value, obtains actual transmission direction:
RX=pParticle- > direction.x;
RY=pParticle- > direction.y;
PParticle- > direction.x=rX × rAngleCos-rY × rAngleSin;
PParticle- > direction.y=rX × rAngleSin+rY × rAngleCos.
Fig. 9 a-9b is in the embodiment of the present invention to the different postrotational launching effect schematic diagrames of particle emitter, wherein If Fig. 9 a shows the launching effect schematic diagram after being rotated by 90 ° to the line transmitter of horizontal direction, Fig. 9 b is shown to level side To oval transmitter rotate 22 degree after launching effect schematic diagram.
Step 104, according to the coordinate position of second launch angle and identified particle emission point, in the particle Emit current particle on transmitter.
Each particle hair according to the coordinate position of the second launch angle and particle emission point, on the particle emitter Exit point emits particle, specifically, can call third party SDK Root::renderOneFrame () when transmitting particle, press Entire contextual data is updated according to the coordinate position of the second launch angle and each particle emission point, to obtain particle emission effect Fruit.
As Figure 10 shows the launching effect of the line transmitter of Z-shaped in Fig. 3 d of the embodiment of the present invention, wherein transmitter Launch angle be 0, the transmitting range of transmitter is 0, and the angle of transmitter is 0, particle rapidity 0.
The embodiment of the present invention is first depending on particle total length or total angle after the particle emitter for receiving creation, with And emit the number of the particle emission point of particle on the particle emitter, so that it is determined that the particle emission point of transmitting current particle Coordinate position, then according to setting transmitting particle the first launch angle, the direction of the launch and transmitter angle, determine each The second launch angle for emitting particle on particle emission point, finally according to the launch angle and launch point of determining particle emission point Coordinate position emit current particle, can according to it is specific need to select by a line segment, it is the first be connected it is multiple not parallel Line segment, ellipse or circle, the transmitting of the different modes such as corresponding line transmitting, oval transmitting, circle transmitting is carried out, to be particle Transmitting provides diversified radiation pattern.
It should be noted that for the aforementioned method embodiment, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described, because according to According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know that, The embodiments described in the specification are all preferred embodiments, and related movement is not necessarily essential to the invention.
Based on the description of the above method embodiment, the present invention also provides corresponding particle emission Installation practices, come real Content described in existing above method embodiment.
Referring to Fig. 2, it illustrates a kind of structural block diagrams of particle emission device described in the embodiment of the present invention, specifically can wrap It includes:
Creation module 201, for receiving the particle emitter of creation, the particle emitter includes line segment, a head and the tail Connected multiple not parallel line segments, ellipse or circle;
Position determination module 202, for total length or total angle according to the particle emitter, transmitter angle and institute The number for emitting the particle emission point of particle on particle emitter is stated, determines the coordinate bit of the particle emission point of transmitting current particle It sets;
Angle-determining module 203, the first launch angle, the direction of the launch and transmitter for the transmitting particle according to setting Angle determines the second launch angle for emitting particle on particle emission point;
Transmitting module 204, for the position according to second launch angle and identified particle emission point, described Emit current particle on particle emitter.
In embodiments of the present invention, the position determination module may include:
Computational submodule, for calculating the total length or total angle of the particle emitter;
It is spaced and determines submodule, for the total length or total angle and the particle emitter by the particle emitter The number for emitting the particle emission point of particle obtains the relative position of the particle emission point of transmitting current particle;
Launch point position determines submodule, for the coordinate position by the relative position and the particle emitter, obtains To the initial position of the particle emission point of transmitting current particle;
Coordinate position determines submodule, for being rotated counterclockwise according to the transmitter angle to the initial position Obtain the coordinate position of the particle emission point of transmitting particle.
In embodiments of the present invention, if the radiation pattern of the particle emitter is set as a transmitting, the interval is determined Submodule may include:
Launch point number determines subelement, for for emitting the particle emission point of particle on particle emitter to be randomly generated Number, the number of the particle emission point are the emission maximum points purpose positive number less than setting;
Interval calculation subelement, for the number by the total length or total angle and particle emission point product with it is described The quotient of emission maximum point number obtains the relative position of the particle emission point of transmitting current particle.
In embodiments of the present invention, if the radiation pattern of the particle emitter is set as non-dots transmitting, the interval is true Stator modules include:
It is spaced generating subunit, the relative position of the particle emission point for transmitting current particle to be randomly generated, the phase Contraposition is set to the positive number of total length or total angle less than the particle emitter.
In embodiments of the present invention, the angle-determining module may include:
Angle calculation submodule calculates hair for the launch angle parameter, transmitting range parameter and the direction of the launch by being arranged First launch angle of radion;
Angle rotates submodule, for being rotated first launch angle counterclockwise according to the transmitter angle Obtain the second launch angle of transmitting particle.
In embodiments of the present invention, the angle calculation submodule may include:
Interior transmitting subelement is used for when the direction of the launch is interior transmitting, by the launch angle parameter and the angle of departure It spends the sum of adjusted value and is used as first launch angle, the launch angle adjusted value is just less than the transmitting range parameter Number;
Outer transmitting subelement is used for when the direction of the launch is outer transmitting, by the launch angle parameter and the angle of departure The negative value of the sum of adjusted value is spent as first launch angle, and the launch angle adjusted value is to be generated at random less than described The positive number of transmitting range parameter;
Inside and outside transmitting subelement is used for when the direction of the launch is inside and outside transmitting, by the first of each particle emission point Launch angle is set to the sum of the launch angle parameter and launch angle adjusted value and first launch angle is The negative value of the sum of the launch angle parameter and launch angle adjusted value.
In embodiments of the present invention, when the particle emitter is that oval or bowlder, the angle calculation submodule may be used also To include:
Angle determines subelement, for calculating cutting for position for the particle emission point on the particle emitter The angle of line vector and horizontal axis;
Subelement is rotated, for being rotated counterclockwise according to the angle to first launch angle.
The embodiment of the present invention is first depending on particle total length or total angle after the particle emitter for receiving creation, with And emit the number of the particle emission point of particle on the particle emitter, so that it is determined that the particle emission point of transmitting current particle Coordinate position, then according to setting transmitting particle the first launch angle, the direction of the launch and transmitter angle, determine each The second launch angle for emitting particle on particle emission point, finally according to the launch angle and launch point of determining particle emission point Coordinate position emit current particle, can according to it is specific need to select by a line segment, it is the first be connected it is multiple not parallel Line segment, ellipse or circle, the transmitting of the different modes such as corresponding line transmitting, oval transmitting, circle transmitting is carried out, to be particle Transmitting provides diversified radiation pattern.
For the embodiment of above-mentioned particle emission device, since it is basically similar to the method embodiment, so description Fairly simple, the part explanation of related place embodiment of the method shown in Figure 1.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are with The difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
It would have readily occurred to a person skilled in the art that: any combination application of above-mentioned each embodiment is all feasible, therefore Any combination between above-mentioned each embodiment is all embodiment of the present invention, but this specification exists as space is limited, This is not just detailed one by one.
The present invention can be used in numerous general or special purpose computing system environments or configuration.Such as: personal computer, service Device computer, handheld device or portable device, laptop device, multicomputer system, microprocessor-based system, top set Box, programmable consumer-elcetronics devices, network PC, minicomputer, mainframe computer, including any of the above system or equipment Distributed computing environment etc..
Finally, it is to be noted that, herein, the terms "include", "comprise" not only include those elements, but also Further include other elements that are not explicitly listed, or further include for this process, method, article or equipment it is intrinsic Element.In the absence of more restrictions, the element limited by sentence " including ... ", it is not excluded that including described want There is also other identical elements in the process, method, article or equipment of element.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications can be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Above to a kind of particle emission method and device provided by the present invention, it is described in detail, it is used herein A specific example illustrates the principle and implementation of the invention, and the above embodiments are only used to help understand Method and its core concept of the invention;At the same time, for those skilled in the art is having according to the thought of the present invention There will be changes in body embodiment and application range, in conclusion the content of the present specification should not be construed as to the present invention Limitation.

Claims (8)

1. a kind of particle emission method characterized by comprising
The particle emitter of creation is received, the particle emitter includes a line segment, end to end multiple not parallel lines Section, oval or circle;
According to transmitting particle on the total length or total angle of the particle emitter, transmitter angle and the particle emitter The number of particle emission point determines the coordinate position of the particle emission point of transmitting current particle;
The first launch angle, the direction of the launch and the transmitter angle of transmitting particle according to setting, determine and send out on particle emission point Second launch angle of radion, the direction of the launch include interior transmitting, outer transmitting and inside and outside transmitting, comprising: by the hair being arranged Angle parameter, transmitting range parameter and the direction of the launch are penetrated, the first launch angle of transmitting particle is calculated;According to the transmitter angle First launch angle is carried out rotation counterclockwise and obtains the second launch angle of transmitting particle by degree;
According to the coordinate position of second launch angle and identified particle emission point, emit on the particle emitter Current particle.
2. the method according to claim 1, wherein the total length or child's hair twisted in a knot-childhood according to the particle emitter The number for emitting the particle emission point of particle on degree, transmitter angle and the particle emitter determines transmitting current particle The step of coordinate position of particle emission point includes:
Calculate the total length or total angle of the particle emitter;
By the particle emission point of transmitting particle on the total length or total angle and the particle emitter of the particle emitter Number obtains the relative position of the particle emission point of transmitting current particle;
By the coordinate position of the relative position and the particle emitter, the first of the particle emission point of transmitting current particle is obtained Beginning position;
The initial position is carried out according to the transmitter angle to rotate the particle emission point for obtaining transmitting particle counterclockwise Coordinate position.
3. according to the method described in claim 2, it is characterized in that, if the radiation pattern of the particle emitter is set as a hair It penetrates, the particle emission point of particle is emitted on the total length or total angle by the particle emitter and the particle emitter Number, obtain transmitting current particle particle emission point relative position the step of include:
Be randomly generated the number for emitting the particle emission point of particle on particle emitter, the number of the particle emission point be less than The emission maximum points purpose positive number of setting;
By the product of the number of the total length or total angle and particle emission point and the quotient of the emission maximum point number, obtain Emit the relative position of the particle emission point of current particle.
4. according to the method described in claim 2, it is characterized in that, if the radiation pattern of the particle emitter is set as non-dots Emit the particle emission of particle on transmitting, the total length or total angle by the particle emitter and the particle emitter Point number, obtain transmitting current particle particle emission point relative position the step of include:
The relative position of the particle emission point of transmitting current particle is randomly generated, the relative position is less than the particle emission The total length of device or the positive number of total angle.
5. the method according to claim 1, wherein launch angle parameter, the transmitting range ginseng by being arranged The several and direction of the launch, the step of calculating the first launch angle of transmitting particle include:
When the direction of the launch is interior transmitting, by the sum of the launch angle parameter and launch angle adjusted value conduct described the One launch angle, the launch angle adjusted value are the positive number less than the transmitting range parameter;
When the direction of the launch be outer transmitting when, using the negative value of the sum of the launch angle parameter and launch angle adjusted value as First launch angle, the launch angle adjusted value are the positive number less than the transmitting range parameter generated at random;
When the direction of the launch is inside and outside transmitting, the first launch angle of each particle emission point is set to the hair It penetrates the sum of angle parameter and launch angle adjusted value and first launch angle is the launch angle parameter and the angle of departure Spend the negative value of the sum of adjusted value.
6. according to the method described in claim 5, it is characterized in that, when the particle emitter is oval or bowlder, it is described by The step of launch angle parameter and transmitting range parameter of setting, the first launch angle of calculating transmitting particle further include:
For the particle emission point on the particle emitter, the tangent line rector of position and the folder of horizontal axis are calculated Angle;
First launch angle is rotated counterclockwise according to the angle.
7. a kind of particle emission device characterized by comprising
Creation module, for receiving the particle emitter of creation, the particle emitter includes a line segment, end to end more A not parallel line segment, ellipse or circle;
Position determination module, for total length or total angle according to the particle emitter, transmitter angle and the particle The number for emitting the particle emission point of particle on transmitter determines the coordinate position of the particle emission point of transmitting current particle;
Angle-determining module, for the first launch angle, the direction of the launch and the transmitter angle of the transmitting particle according to setting, really Surely emit the second launch angle of particle, the direction of the launch includes interior transmitting, outer transmitting and inside and outside transmitting;
Transmitting module, for the coordinate position according to second launch angle and identified particle emission point, in the grain Sub- transmitter emits current particle;
The angle-determining module includes:
Angle calculation submodule calculates transmitting grain for the launch angle parameter, transmitting range parameter and the direction of the launch by being arranged First launch angle of son;
Angle rotates submodule, obtains for first launch angle to be carried out rotation counterclockwise according to the transmitter angle Emit the second launch angle of particle on the particle emission point.
8. device according to claim 7, which is characterized in that the position determination module includes:
Computational submodule, for calculating the total length or total angle of the particle emitter;
It is spaced and determines submodule, emit on the total length or total angle and the particle emitter by the particle emitter The number of the particle emission point of particle obtains the relative position of the particle emission point of transmitting current particle;
Initial position determines submodule, for the coordinate position by the relative position and the particle emitter, is emitted The initial position of the particle emission point of current particle;
Coordinate position determines submodule, obtains for carrying out rotation counterclockwise to the initial position according to the transmitter angle Emit the coordinate position of the particle emission point of particle.
CN201310215235.8A 2013-05-31 2013-05-31 A kind of particle emission method and apparatus Active CN103325132B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310215235.8A CN103325132B (en) 2013-05-31 2013-05-31 A kind of particle emission method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310215235.8A CN103325132B (en) 2013-05-31 2013-05-31 A kind of particle emission method and apparatus

Publications (2)

Publication Number Publication Date
CN103325132A CN103325132A (en) 2013-09-25
CN103325132B true CN103325132B (en) 2019-02-22

Family

ID=49193855

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310215235.8A Active CN103325132B (en) 2013-05-31 2013-05-31 A kind of particle emission method and apparatus

Country Status (1)

Country Link
CN (1) CN103325132B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147928A (en) * 2011-03-16 2011-08-10 美通日用品(杭州)有限公司 Improved flame-simulation acceleration algorithm based on particle system
EP2472556A2 (en) * 2010-12-31 2012-07-04 FEI Company Charged particle source with multiple selectable particle emitters
CN102608437A (en) * 2012-04-11 2012-07-25 北京航空航天大学 Electromagnetic solving method for particle launching simulation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2472556A2 (en) * 2010-12-31 2012-07-04 FEI Company Charged particle source with multiple selectable particle emitters
CN102147928A (en) * 2011-03-16 2011-08-10 美通日用品(杭州)有限公司 Improved flame-simulation acceleration algorithm based on particle system
CN102608437A (en) * 2012-04-11 2012-07-25 北京航空航天大学 Electromagnetic solving method for particle launching simulation

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Physically Based Modeling: Particle System Dynamics;Witkin A等;《AcmSiggraph Course Notes》;20011231;全文
发射器属性;Jmwlh1991;《https://wenku.baidu.com/view/0a78ca2f4b35eefdc8d333b6.html?from=search》;20130311;全文
真实感通用粒子系统的实时渲染研究与实现;曹阳勇;《中国优秀硕士学位论文全文数据库 信息科技辑》;20111215;全文

Also Published As

Publication number Publication date
CN103325132A (en) 2013-09-25

Similar Documents

Publication Publication Date Title
CN106407008B (en) Dig mine method for processing business, device and system
AU2017276254B2 (en) Edge computing platform
JP2022020736A (en) Transportation of signal via imperfection electromagnetic path
US20160292426A1 (en) Method and Apparatus for Scrambling a High Speed Data Transmission
CN109388661A (en) A kind of model training method and device based on shared data
CN105208108B (en) File upload/method for down loading and system, server, client under Web environment
CN108629823A (en) The generation method and device of multi-view image
US11625140B2 (en) Configuring remote devices through volumetric video telepresence interfaces
EP3340615A1 (en) Method and system for visually and remotely controlling touch-enabled device, and relevant device
CN111898484A (en) Method and device for generating model, readable storage medium and electronic equipment
CN112434620B (en) Scene text recognition method, device, equipment and computer readable medium
CN106950534A (en) A kind of locus detection method, system and VR wearable devices
US20130257686A1 (en) Distributed virtual reality
CN105809066B (en) The storage method and terminal of encryption data
WO2021247038A1 (en) Systems and methods for message embedding in three-dimensional image data
CN103325132B (en) A kind of particle emission method and apparatus
CN112615852A (en) Data processing method, related device and computer program product
CN114998433A (en) Pose calculation method and device, storage medium and electronic equipment
CN113449872B (en) Parameter processing method, device and system based on federal learning
CN109242892A (en) Method and apparatus for determining the geometric transform relation between image
CN108595455B (en) Spatial data coordinate conversion method and device
Gupta et al. An architecture for interactive in situ visualization and its transparent implementation in OpenFPM
CN106951324B (en) Parallel operation system and method for rapid FLUKA simulation
CN103310405B (en) A kind of control method and device of Particles Moving
CN107682583B (en) A kind of random interpolation method towards ciphertext image Information hiding

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant