- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
| [package] | |
| name = "rust_win32_gdi" | |
| edition = "2018" | |
| [target.'cfg(windows)'.dependencies.winapi] | |
| version = "0.3.7" | |
| features = [ | |
| "d3d11", | |
| "debugapi", | |
| "libloaderapi", |
| # module load StdEnv | |
| # module swap compilers/intel compilers/gcc | |
| # module load apps/cmake libs/fftw libs/gsl libs/boost libs/ftgl libs/hdf5 apps/python/2.7.5 libs/mkl libs/qt/.4.8.5 | |
| # cd /software6/src | |
| # NAME=eman2 | |
| # VERSION=2.07 | |
| # SRCDIR=EMAN2 | |
| # COMPILER=gcc | |
| # PREFIX=/software6/apps/${NAME}/${VERSION}_${COMPILER} |
| // TransientFuction: A light-weight alternative to std::function [C++11] | |
| // Pass any callback - including capturing lambdas - cheaply and quickly as a | |
| // function argument | |
| // | |
| // Based on: | |
| // https://deplinenoise.wordpress.com/2014/02/23/using-c11-capturing-lambdas-w-vanilla-c-api-functions/ | |
| // | |
| // - No instantiation of called function at each call site | |
| // - Simple to use - use TransientFunction<> as the function argument | |
| // - Low cost: cheap setup, one indirect function call to invoke |
| #include <windows.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdint.h> | |
| #include <gl/gl.h> | |
| #pragma comment(lib, "opengl32.lib") |
| #include "mu.h" | |
| #define _CRT_SECURE_NO_WARNINGS | |
| #include <malloc.h> | |
| #define _USE_MATH_DEFINES | |
| #include <math.h> | |
| #define _NO_CRT_STDIO_INLINE | |
| #include <stdio.h> | |
| #include <stdarg.h> | |
| #define NO_STRICT |
| float3 PositionToOctahedron(float3 position) | |
| { | |
| // Normalize input position to unit sphere to simplify required ops | |
| float3 P = normalize(position); | |
| // Get octant index | |
| float3 side = P >= 0 ? 1 : 0; | |
| float octant_index = side.x + side.y * 2 + side.z * 4; | |
| // Project onto octahedron face, then onto each x/y plane |
| <?xml version='1.0'?> | |
| <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> | |
| <fontconfig> | |
| <dir>~/.fonts</dir> | |
| <alias> | |
| <family>serif</family> | |
| <prefer> | |
| <family>Source Serif Pro</family> | |
| <family>IPAMincho</family> | |
| </prefer> |
| class FileWatcher | |
| { | |
| public: | |
| FileWatcher(const Path& path) | |
| : m_Path(path) | |
| , m_DirHandle(INVALID_HANDLE_VALUE) | |
| , m_BufferSize(CORE_KB(100)) | |
| , m_Buffer(nullptr) | |
| , m_ChangedFiles(1024) | |
| { |
| require 'bindata' | |
| require 'benchmark' | |
| require 'win32/registry' | |
| require 'io/console' | |
| class GGPK | |
| class UTF16String < BinData::String | |
| def snapshot | |
| super.force_encoding('UTF-16LE') | |
| end |