Skip to content

Instantly share code, notes, and snippets.

View lukashaertel's full-sized avatar

Lukas Härtel lukashaertel

  • Koblenz, Germany
View GitHub Profile
@lukashaertel
lukashaertel / AnotherFunneler.kt
Created August 31, 2017 14:52
Generated code of one of the funnelers.
package eu.metatools.kfunnels.tests
import eu.metatools.kfunnels.*
/**
* Funnels and unfunnels Another.
*/
object AnotherFunneler : GeneratedFunneler<Another> {
override val module = eu.metatools.kfunnels.tests.TestsModule
package eu.metatools.kfunnels.tests
import eu.metatools.kfunnels.*
/**
* Funnels and unfunnels Container.
*/
object ContainerFunneler : GeneratedFunneler<Container<*, *>> {
override val module = eu.metatools.kfunnels.tests.TestsModule
@lukashaertel
lukashaertel / genericlerp.kt
Created May 5, 2017 22:22
Generic Linear Interpolation Prototype using Kotlin Serialization
package eu.metatools.kontor.serialization
import java.math.BigDecimal
import java.util.*
import kotlin.reflect.KClass
import kotlin.reflect.full.companionObjectInstance
import kotlin.serialization.*
import kotlin.serialization.internal.*
/**
package org.softlang.ura
/**
* Union type.
* @param T The type of the first option
* @param U The type of the second option
* @param isLeft True if the type is the first option
* @param it The value stored without explicit type information
*/
data class Choice<out T, out U>(val isLeft: Boolean, val it: Any?) {
package ktsandbox
import javax.xml.crypto.Data
/**
* A data point, where first is the hidden state, and second is the observed
* state.
*/
typealias DataPoint = Pair<Int, Int>
@Override
public Optional<Vector3> pick(Properties properties, Matrix4 world, Ray ray) {
// Translate to local space
Ray localRay = ray.cpy().mul(world.cpy().inv());
// Result vector and dot product
Vector3 result = null;
float resultDot = Float.POSITIVE_INFINITY;
// Intersect with all planes
package eu.metatools.risk;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Vector2;
public class Borderizer {
private static <T> T in(T[] t, int i) {
return t[((i % t.length) + t.length) % t.length];
}
@lukashaertel
lukashaertel / Pipes.java
Last active August 29, 2015 13:56
Implementation of a pipe combinator system that supports carrying non-semantic info through pipeline elements.
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* Created by Lukas Härtel on 14.02.14.
*/
public class Pipes {
/**
@lukashaertel
lukashaertel / SensorCollector.iml
Created November 27, 2013 15:09
Modifications to the sensor collector project file. Relevant lines are 18 and 77
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="Debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebug" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />