Skip to content

Instantly share code, notes, and snippets.

View CodeDrome's full-sized avatar

Chris Webb CodeDrome

View GitHub Profile
@CodeDrome
CodeDrome / bretschneidersformula.py
Created March 28, 2022 15:52
bretschneidersformula.py
from functools import reduce
import math
def calculate_area(sides, opposite_angles_degrees):
'''
Calculate the area of a quadrilateral using Bretschneider's Formula
from the lengths of the sides and either pair of OPPOSITE angles.
Arguments:-
@CodeDrome
CodeDrome / quadrilateralareasmain.py
Created March 25, 2022 15:15
quadrilateralareasmain.py
import quadrilateralareas
def main():
print("---------------------------")
print("| codedrome.com |")
print("| Areas of Quadrilaterals |")
print("---------------------------\n")
def square(side):
return side ** 2
def rectangle(width, height):
return width * height
@CodeDrome
CodeDrome / means.py
Created February 3, 2022 14:36
Geometric and Harmonic Means in Python
import math
import numpy as np
def main():
print("--------------------------------")
print("| codedrome.com |")
print("| Geometric and Harmonic Means |")
print("--------------------------------\n")
@CodeDrome
CodeDrome / app.js
Created October 20, 2021 11:51
app.js
"use strict"
window.onload = function()
{
arc();
// pieSlice();
// pieChart();
@CodeDrome
CodeDrome / svgarcandpieslice.js
Created October 20, 2021 11:47
svgarcandpieslice.js
"use strict"
function drawArc(settings)
{
let d = "";
const firstCircumferenceX = settings.centreX + settings.radius * Math.cos(settings.startAngleRadians);
const firstCircumferenceY = settings.centreY + settings.radius * Math.sin(settings.startAngleRadians);
const secondCircumferenceX = settings.centreX + settings.radius * Math.cos(settings.startAngleRadians + settings.sweepAngleRadians);
@CodeDrome
CodeDrome / svgarcandpieslice.html
Created October 20, 2021 11:46
svgarcandpieslice.html
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>SVG Arc and Pie Slice</title>
</head>
</body>
"use strict"
window.onload = function()
{
const plotter = new ParametricEquationsPlotter();
const pe = ParametricEquations.circle;
// const pe = ParametricEquations.ellipse;
// const pe = ParametricEquations.cardioid;
// const pe = ParametricEquations.spiral;
@CodeDrome
CodeDrome / parametricequations.js
Created October 8, 2021 10:38
parametricequations.js
const ParametricEquations =
{
circle:
{
xFunction: function (t) {return Math.cos(t)},
yFunction: function (t) {return Math.sin(t)},
zFunction: function (t) {return 0},
tRange: {start: 0, end: 2 * Math.PI},
tStep: Math.PI / 32,
colour: "#FF0000"
@CodeDrome
CodeDrome / parametricequationsplotter.js
Created October 8, 2021 10:36
parametricequationsplotter.js
class ParametricEquationsPlotter
{
constructor()
{
this._container = null,
this._renderer = null,
this._scene = null,
this._light = null,
this._camera = null,
this._group = null,