Skip to content

Commit c4738d7

Browse files
Add some comments
1 parent 3c03826 commit c4738d7

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

jbox2d-library/src/main/java/de/pirckheimer_gymnasium/jbox2d/dynamics/World.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,6 @@ public void setParticleUserDataBuffer(Object[] buffer, int capacity)
21022102

21032103
/**
21042104
* Get contacts between particles
2105-
*
21062105
*/
21072106
public ParticleContact[] getParticleContacts()
21082107
{
@@ -2116,7 +2115,6 @@ public int getParticleContactCount()
21162115

21172116
/**
21182117
* Get contacts between particles and bodies
2119-
*
21202118
*/
21212119
public ParticleBodyContact[] getParticleBodyContacts()
21222120
{
@@ -2130,7 +2128,6 @@ public int getParticleBodyContactCount()
21302128

21312129
/**
21322130
* Compute the kinetic energy that can be lost by damping force
2133-
*
21342131
*/
21352132
public float computeParticleCollisionEnergy()
21362133
{

jbox2d-library/src/main/java/de/pirckheimer_gymnasium/jbox2d/particle/ParticleBodyContact.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,36 @@ public class ParticleBodyContact
3030
{
3131
/**
3232
* Index of the particle making contact.
33+
*
34+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2ParticleSystem.h#L101-L102
3335
*/
3436
public int index;
3537

3638
/**
3739
* The body making contact.
40+
*
41+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2ParticleSystem.h#L104-L105
3842
*/
3943
public Body body;
4044

4145
/**
4246
* Weight of the contact. A value between 0.0f and 1.0f.
47+
*
48+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2ParticleSystem.h#L110-L111
4349
*/
4450
float weight;
4551

4652
/**
4753
* The normalized direction from the particle to the body.
54+
*
55+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2ParticleSystem.h#L113-L114
4856
*/
4957
public final Vec2 normal = new Vec2();
5058

5159
/**
5260
* The effective mass used in calculating force.
61+
*
62+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2ParticleSystem.h#L116-L117
5363
*/
5464
float mass;
5565
}

jbox2d-library/src/main/java/de/pirckheimer_gymnasium/jbox2d/particle/ParticleColor.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* Small color object for each particle
3030
*
3131
* @author Daniel Murphy
32+
*
33+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2Particle.h#L80-L266
3234
*/
3335
public class ParticleColor
3436
{
@@ -42,6 +44,17 @@ public ParticleColor()
4244
a = (byte) 50;
4345
}
4446

47+
/**
48+
* Constructor with four elements: r (red), g (green), b (blue), and a
49+
* (opacity). Each element can be specified 0 to 255.
50+
*
51+
* @param r red
52+
* @param g green
53+
* @param b blue
54+
* @param a alpha (opacity)
55+
*
56+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2Particle.h#L84-L91
57+
*/
4558
public ParticleColor(byte r, byte g, byte b, byte a)
4659
{
4760
set(r, g, b, a);
@@ -68,11 +81,29 @@ public void set(ParticleColor color)
6881
a = color.a;
6982
}
7083

84+
/**
85+
* True when all four color elements equal 0. When true, a particle color
86+
* buffer isn't allocated.
87+
*
88+
* @return True when all four color elements equal 0.
89+
*
90+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2Particle.h#L97-L103
91+
*/
7192
public boolean isZero()
7293
{
7394
return r == 0 && g == 0 && b == 0 && a == 0;
7495
}
7596

97+
/**
98+
* Sets color for current object using the four elements described above.
99+
*
100+
* @param r red
101+
* @param g green
102+
* @param b blue
103+
* @param a alpha (opacity)
104+
*
105+
* @permalink https://github.com/google/liquidfun/blob/7f20402173fd143a3988c921bc384459c6a858f2/liquidfun/Box2D/Box2D/Particle/b2Particle.h#L109-L117
106+
*/
76107
public void set(byte r, byte g, byte b, byte a)
77108
{
78109
this.r = r;

jbox2d-library/src/main/java/de/pirckheimer_gymnasium/jbox2d/particle/ParticleContact.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@
2828
public class ParticleContact
2929
{
3030
/**
31-
* Indices of the respective particles making contact.
31+
* Index of the respective particle making contact.
3232
*/
33-
public int indexA, indexB;
33+
public int indexA;
34+
35+
/**
36+
* Index of the respective particle making contact.
37+
*/
38+
public int indexB;
3439

3540
/**
3641
* The logical sum of the particle behaviors that have been set.

0 commit comments

Comments
 (0)