Skip to content

Instantly share code, notes, and snippets.

@mauro3
mauro3 / fd.jl
Created June 30, 2016 20:01
forwarddiff with in-place functions
using ForwardDiff
const T = Float64 # the datatype used, probably Float64
const dof = 4
fn!(;T_::Type=T, dof_=dof) = zeros(T_,dof_)
function fn!(res, y)#, dydt)
@show typeof(res), typeof(y)
for i=1:dof
@mauro3
mauro3 / inpoly.jl
Created October 11, 2016 19:28
inpoly using winding number
"""
Determines the winding number of a point and a polygon, i.e. how many
times a polygon winds around the point.
It follows Dan Sunday: http://geomalgorithms.com/a03-_inclusion.html.
"""
function windnr(p, poly::Matrix)
@assert length(p)==2
@assert poly[:,1]==poly[:,end]
# Loop over edges
@mauro3
mauro3 / Project.toml
Last active November 7, 2023 21:51
Appl-GL Ng & Björnsson 2003
[deps]
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"