Skip to content

Instantly share code, notes, and snippets.

View Cranc's full-sized avatar

Dennis Lindner Cranc

View GitHub Profile
// Segment divider (currently at a fixed length)
int div;
int div_c;
float upper_limit;
float bottom_limit;
if (dy < dx)
div_c = Math.abs(dy);
else
div_c = Math.abs(dx);
if (div_c < 10)
package model.drawables;
import java.awt.Graphics;
/**
* Klasse, die eine Linie repräsentiert. Eine Linie besteht aus zwei
* Punkten. Diese Punkte dienen als Start- und Endpunkt fuer den Bresenham
* Algorithmus.
*
* @author Nicolas Neubauer
public class Cube3D {
private int red_min;
private int green_min;
private int blue_min;
private int red_max;
private int green_max;
private int blue_max;
//private Map<Integer,Integer> color;
private ArrayList<MyPoint> points;
/**
* cuts the Cube into two cubes by red value.
* @return List containing the new Cubes (left and right | up and down | front and back).
*/
public ArrayList<Cube3D> r_cut() {
Comparator<MyPoint> sort = new Comparator<MyPoint>() {
@Override
public int compare(MyPoint o1, MyPoint o2) {
return o1.cords[0] - o2.cords[0];
}
import java.io.PrintWriter;
/**
* @author Lukas Kalbertodt
*/
public class Sierpinski {
private static int svgHeight = 1000;
private static int svgWidth = 1000;
private static String HTMLHeader = "<!DOCTYPE html>\n" +
"<html>\n" +
@Cranc
Cranc / achievments.rs
Last active July 26, 2016 09:10
achievment system for creating, maintaining and updating of achievments in rust
use std::collections::{HashMap, HashSet};
/// <summary>
///
/// </summary>
/// <param name=""></param>
fn main() {
let mut ach_dic = Achiev::new();
println!("add property kill cats with kill > 10");
ach_dic.define_property("kill cats",0,ACTIVE_IF_GREATER_THAN,10);
use base::math::*;
use std::f64::consts::PI;
enum SIDE {
Top,
Bottom,
Left,
Right,
NearP,
FarP,
}
@Cranc
Cranc / Logger.cs
Created August 17, 2016 13:32
c# Logger that writes into a RichTextBox with special tags and can decide which things to print (ideal for debug vs release info logs)
using System;
using System.Windows.Forms;
namespace TagRemover
{
class Log
{
/// <summary>
/// Types used to define the type of Message (is used by the Log to determing if Message needs to be displayed).
/// </summary>
public void Main(string argument) {
//get furnaces
var furnace_list = new List<IMyTerminalBlock>();
var temp_list = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyRefinery>(temp_list);
foreach(IMyTerminalBlock t in temp_list) {
if( t.CustomName.Contains("Furnace"))
using System;
using System.Runtime.InteropServices;
using System.Threading;
namespace MouseClick
{
/// <summary>
/// Class represents a button click.
/// </summary>
class ButtonClick