Skip to content

Instantly share code, notes, and snippets.

public static class Gdi
{
public static Pen Stroke { get; set; } = new Pen(Color.Black, 0);
public static SolidBrush Fill { get; set; } = new SolidBrush(Color.Black);
public static Font Font { get; set; } = SystemFonts.CaptionFont;
/// <summary>
/// Adds an arrow to the start of a <see cref="Pen"/> object.
/// </summary>
/// <remarks>Intended to be used with <see cref="Stroke"/></remarks>
@ja72
ja72 / Form1.cs
Last active April 26, 2023 15:02
Extension methods to draw shapes defined by `System.Numerics.Vector2` coordinates using GDI and `System.Drawing.Graphics` with example code for a WinForms project (Framework 4.8)
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Numerics;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
@ja72
ja72 / Rigid Body Dynamics.html
Last active March 3, 2021 00:48
Angular Momentum and Torque on a Rigid Body
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rigid Body Dynamics</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</head>
@ja72
ja72 / table_support.f90
Last active February 7, 2019 20:10
Calculate the table support forces for an irregular polygon table.
program table_support
! code to accomapny the follwoing Physics.SE answer
! https://physics.stackexchange.com/a/459404/392
implicit none
! Variables
integer :: i, n
real, allocatable :: x(:), y(:), F(:)
real :: C_x, C_y, d, W