source: node_modules/d3-shape/src/symbol/diamond.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 329 bytes
Line 
1import {sqrt} from "../math.js";
2
3const tan30 = sqrt(1 / 3);
4const tan30_2 = tan30 * 2;
5
6export default {
7 draw(context, size) {
8 const y = sqrt(size / tan30_2);
9 const x = y * tan30;
10 context.moveTo(0, -y);
11 context.lineTo(x, 0);
12 context.lineTo(0, y);
13 context.lineTo(-x, 0);
14 context.closePath();
15 }
16};
Note: See TracBrowser for help on using the repository browser.