Skip to content

Instantly share code, notes, and snippets.

View BlackHC's full-sized avatar

Andreas Kirsch BlackHC

View GitHub Profile
to determine the intersection point of 3 planes in R^3:
if the 3 planes are specified using 4-component vectors a,b,c (a * v = 0 if the homogeneous vector v is on plane a, etc)
build the 4x4 matrix
(
x y z w
a^T
b^T
bool hasCycle( Element *head ) {
Element *guard = head;
Element *current = head;
bool updateGuard = false;
while( current ) {
current = current->next;
if( current == guard ) {
return true;
}
if( updateGuard ) {
void drawEighthOfCircle( int radius ) {
int y = radius;
int x = 0;
// invariant: radius^2 <= x^2 + y^2 < (radius+1)^2
int maxLength = (radius+1)*(radius+1);
while( x <= y ) {
setPixel( x, y );
x++;
@BlackHC
BlackHC / gist:5494587
Created May 1, 2013 10:16
intersection line of two planes
to determine the intersection line of two planes
planes A, B given by R^4 vectors, so that A*x = 0 if x on A, x homogeneous in R^4.
det( A, B, *, * ) is the solution space of all intersection vectors in R^4.
det( A, B, (0 0 0 1), * ) is the solution space of the direction vector d. extract it by pulling it into a R^4 vector d = (* 0).
det( A, B, *, d ) is the solution space of a point on the line. extract it by pulling it into a R^4 vector s.
@BlackHC
BlackHC / SassMeister-input.scss
Created September 29, 2014 21:53
Generated by SassMeister.com.
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
feature-info {
shadowing: feature-exists(global-variable-shadowing);
}
$var: red;
@BlackHC
BlackHC / SassMeister-input.scss
Created September 30, 2014 14:45
Generated by SassMeister.com.
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
feature-info {
shadowing: feature-exists(global-variable-shadowing);
}
$var: red;
@BlackHC
BlackHC / dabblet.css
Created October 2, 2014 11:19
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@BlackHC
BlackHC / SassMeister-input-HTML.html
Last active August 29, 2015 14:08
Generated by SassMeister.com.
<table class="mytable">
<tfoot>
<tr>
<td class="mytd">
Hello
</td>
</tr>
</tfoot>
</table>
@BlackHC
BlackHC / SassMeister-input-HTML.html
Last active August 29, 2015 14:08
Generated by SassMeister.com.
<table class="mytable">
<tfoot>
<tr>
<td class="mytd">
Hello
</td>
</tr>
</tfoot>
</table>
@BlackHC
BlackHC / SassMeister-input-HTML.html
Created October 29, 2014 09:08
Generated by SassMeister.com.
<table class="mytable">
<tfoot>
<tr>
<td class="mytd">
Hello
</td>
</tr>
</tfoot>
</table>