Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Arnebäck Erkaman

View GitHub Profile
View gauss_seidel_graph_coloring.cpp
/*
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View jacobi_vs_gauss_seidel.cpp
/*
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
View shoelace.cpp
/*
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
View cubeflip.js
/*
The MIT License (MIT)
Copyright (c) 2017 Eric Arnebäck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
View barchart.js
/*
The MIT License (MIT)
Copyright (c) 2017 Eric Arnebäck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View main.js
/*
The MIT License (MIT)
Copyright (c) 2017 Eric Arnebäck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@Erkaman
Erkaman / fragment_shader.glsl
Last active Apr 5, 2017
broken shader. please check the comments at end of fragment shader.
View fragment_shader.glsl
#version 430
#define GLUINT_MAX 4294967295
#define NULL_NODE (GLUINT_MAX - 0)
#define SUBDIVIDE_NODE (GLUINT_MAX - 1)
#define LEAF_NODE (GLUINT_MAX - 2)
// node in the octree.
struct OctNode {
@Erkaman
Erkaman / broken_shader.fs
Created Feb 20, 2017
broken_shader.vs is the broken shader.
View broken_shader.fs
// empty fragment shader.
void main()
{
}
@Erkaman
Erkaman / gist:84403e52ce194a168e5112b13ca4e85a
Created Jan 29, 2017
Cholesky Decomposition Explanation.
View gist:84403e52ce194a168e5112b13ca4e85a
############################################################
How to solve a matrix equation with Cholesky Decomposition
############################################################
We want to solve the matrix equation Ax=b. So we want x. The Cholesky decomposition of A is just
the matrix product A = L(L^T). Where L is some lower triangular matrix, and L^T is its transpose.
So L^T is upper triangular. See wikipedia an example of such a decomposition:
https://en.wikipedia.org/wiki/Cholesky_decomposition#Example
If we now substitute our decomposition of A into our equation we get
View cone_tracing_vis.js
/*
The MIT License (MIT)
Copyright (c) 2016 Eric Arnebäck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is