Skip to content

Instantly share code, notes, and snippets.

@Waterpicker
Created October 9, 2017 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Waterpicker/e592c0517cab187a43d78defbbcd874e to your computer and use it in GitHub Desktop.
Save Waterpicker/e592c0517cab187a43d78defbbcd874e to your computer and use it in GitHub Desktop.
public abstract class ObjectBase {
protected Multimap<ParticleEffect, Vector4d> set_v = ArrayListMultimap.create();
public void render(Viewer viewer, Matrix4d... matrices) {
for(Map.Entry<ParticleEffect, Vector4d> entry : set_v.entries()) {
Vector4d transformed = entry.getValue();
for(Matrix4d m : matrices) {
transformed = m.transform(transformed);
}
viewer.spawnParticles(entry.getKey(), transformed.toVector3());
}
};
}
class ParametricEquation extends ObjectBase {
private int counter;
private ParametricEquation(ParticleEffect effect, Function<Double, Vector3d> function, double interval) {
double increment = 16;
for (double i = 0d; i <= TrigMath.TWO_PI * interval; i += TrigMath.TWO_PI / increment) {
Vector4d current = function.apply(i).toVector4(1);
set_v.put(effect, current);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment