Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95022173
newtonparticle.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Dec 12, 05:43
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Dec 14, 05:43 (2 d)
Engine
blob
Format
Raw Data
Handle
22910334
Attached To
rSYMKIT symkit
newtonparticle.cpp
View Options
#include "newtonparticle.h"
#include "descriptors/newton.h"
NewtonParticle
::
NewtonParticle
(
GLModel
*
model
,
const
double
&
mass
,
const
SVector
<
3
>&
position
,
const
SVector
<
3
>&
speed
,
const
QString
&
label
,
specs_t
flags
)
:
Particle
(
NULL
,
model
,
label
,
flags
)
{
newtonDescriptor
=
new
NewtonDescriptor
(
mass
,
position
,
speed
);
bind
(
newtonDescriptor
);
}
NewtonParticle
::
NewtonParticle
(
const
NewtonDescriptor
&
desc
,
GLModel
*
model
,
const
QString
&
label
,
specs_t
flags
)
:
Particle
(
NULL
,
model
,
label
,
flags
)
{
newtonDescriptor
=
new
NewtonDescriptor
(
desc
);
bind
(
newtonDescriptor
);
}
NewtonParticle
::~
NewtonParticle
()
{
release
();
/* Delete the instance */
delete
newtonDescriptor
;
}
/* returns the position of the NewtonParticle */
SVector
<
3
>
NewtonParticle
::
position
()
const
{
return
newtonDescriptor
->
position
;
}
/* apply a force to the NewtonParticle */
void
NewtonParticle
::
addForce
(
const
SVector
<
3
>
&
force
)
{
newtonDescriptor
->
forces
+=
force
;
}
/* get the mass of the NewtonParticle */
double
NewtonParticle
::
mass
()
const
{
return
newtonDescriptor
->
mass
;
}
/* get the speed of the NewtonParticle */
const
SVector
<
3
>&
NewtonParticle
::
speed
()
const
{
return
newtonDescriptor
->
speed
;
}
/* set the speed of the NewtonParticle */
void
NewtonParticle
::
setSpeed
(
const
SVector
<
3
>&
speed
)
{
newtonDescriptor
->
speed
=
speed
;
}
/* set the mass of the NewtonParticle */
void
NewtonParticle
::
setMass
(
double
mass
)
{
newtonDescriptor
->
mass
=
mass
;
}
Event Timeline
Log In to Comment