@rangefoundry/svg-drawings 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +21 -1
- package/dist/bullet/density.d.ts +65 -0
- package/dist/bullet/density.js +91 -0
- package/dist/bullet/figure.d.ts +34 -0
- package/dist/bullet/figure.js +50 -0
- package/dist/bullet/index.d.ts +4 -0
- package/dist/bullet/index.js +5 -0
- package/dist/bullet/outline.d.ts +144 -0
- package/dist/bullet/outline.js +683 -0
- package/dist/bullet/profile.d.ts +76 -0
- package/dist/bullet/profile.js +257 -0
- package/dist/cartridge/callouts.d.ts +18 -0
- package/dist/cartridge/callouts.js +153 -0
- package/dist/cartridge/detail.d.ts +34 -0
- package/dist/cartridge/detail.js +99 -0
- package/dist/cartridge/figure.d.ts +59 -0
- package/dist/cartridge/figure.js +113 -0
- package/dist/cartridge/figures.d.ts +47 -0
- package/dist/cartridge/figures.js +54 -0
- package/dist/cartridge/focus.d.ts +3 -0
- package/dist/cartridge/focus.js +7 -0
- package/dist/cartridge/index.d.ts +8 -0
- package/dist/cartridge/index.js +8 -0
- package/dist/cartridge/profile.d.ts +46 -0
- package/dist/cartridge/profile.js +630 -0
- package/dist/cartridge/regions.d.ts +28 -0
- package/dist/cartridge/regions.js +50 -0
- package/dist/core/advances.json +106 -0
- package/dist/core/annotate.d.ts +11 -0
- package/dist/core/annotate.js +715 -0
- package/dist/core/cache.d.ts +4 -0
- package/dist/core/cache.js +16 -0
- package/dist/core/face.d.ts +56 -0
- package/dist/core/face.js +54 -0
- package/dist/core/fillet.d.ts +7 -0
- package/dist/core/fillet.js +42 -0
- package/dist/core/geometry.d.ts +22 -0
- package/dist/core/geometry.js +136 -0
- package/dist/core/layout.d.ts +46 -0
- package/dist/core/layout.js +69 -0
- package/dist/core/placer.d.ts +60 -0
- package/dist/core/placer.js +291 -0
- package/dist/core/section.d.ts +32 -0
- package/dist/core/section.js +75 -0
- package/dist/core/text.d.ts +19 -0
- package/dist/core/text.js +38 -0
- package/dist/core/types.d.ts +185 -0
- package/dist/core/types.js +2 -0
- package/dist/core/units.d.ts +18 -0
- package/dist/core/units.js +26 -0
- package/dist/core/vector.d.ts +8 -0
- package/dist/core/vector.js +23 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/seating/chamber.d.ts +21 -0
- package/dist/seating/chamber.js +23 -0
- package/dist/seating/index.d.ts +3 -0
- package/dist/seating/index.js +4 -0
- package/dist/seating/preview.d.ts +12 -0
- package/dist/seating/preview.js +30 -0
- package/dist/seating/seating.d.ts +210 -0
- package/dist/seating/seating.js +284 -0
- package/dist/target/face.d.ts +68 -0
- package/dist/target/face.js +50 -0
- package/dist/target/index.d.ts +1 -0
- package/dist/target/index.js +2 -0
- package/package.json +60 -4
package/README.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
# @rangefoundry/svg-drawings
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Figure models of cartridge drawings, bullet outlines, the seating of a bullet in its chamber and target faces: lines, arcs, dimensions and labels that a renderer turns into SVG or canvas. No DOM, React or I/O; lengths in mm, angles in degrees.
|
|
4
|
+
|
|
5
|
+
With Node 22 or later:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @rangefoundry/svg-drawings
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { lengthText } from '@rangefoundry/svg-drawings'
|
|
13
|
+
import { revolutionVolume } from '@rangefoundry/svg-drawings/bullet'
|
|
14
|
+
|
|
15
|
+
console.log(lengthText(25.4, 'in')) // 1.0000
|
|
16
|
+
console.log(revolutionVolume([[0, 0], [4, 0], [4, 10], [0, 10]], 10).toFixed(1)) // 502.7
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Documentation: https://rangefoundry.github.io/workbench/docs/libraries/drawing/
|
|
20
|
+
|
|
21
|
+
Changes: https://github.com/RangeFoundry/workbench/blob/main/packages/svg-drawings/CHANGELOG.md
|
|
22
|
+
|
|
23
|
+
License: AGPL-3.0-or-later
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type BulletValues } from './profile.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Density of lead at 20 °C, g/cm³ (Wikipedia, "Lead", infobox, https://en.wikipedia.org/wiki/Lead,
|
|
4
|
+
* retrieved 2026-11-01).
|
|
5
|
+
*/
|
|
6
|
+
export declare const leadDensity = 11.348;
|
|
7
|
+
/**
|
|
8
|
+
* Density of copper at 20 °C, g/cm³ (Wikipedia, "Copper", infobox,
|
|
9
|
+
* https://en.wikipedia.org/wiki/Copper, retrieved 2026-11-01).
|
|
10
|
+
*/
|
|
11
|
+
export declare const copperDensity = 8.935;
|
|
12
|
+
/**
|
|
13
|
+
* The material class of a bullet for its density bound: `lead` for a cast, swaged or plated bullet
|
|
14
|
+
* or a lead core without a jacket, `copper` for a monolithic bullet or a copper core without a
|
|
15
|
+
* jacket, `jacketed` for a jacket or a jacketed structure.
|
|
16
|
+
*/
|
|
17
|
+
export type MaterialClass = 'lead' | 'copper' | 'jacketed';
|
|
18
|
+
/** The construction fields the class reads; a bullet record's `construction` is assignable to it. */
|
|
19
|
+
export interface DensityConstruction {
|
|
20
|
+
structure?: string | undefined;
|
|
21
|
+
core?: {
|
|
22
|
+
material: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
jacket?: object | undefined;
|
|
25
|
+
unmapped?: true | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The material class of a construction; undefined where it does not settle one, as for a core of
|
|
29
|
+
* another metal or a core that contradicts the structure.
|
|
30
|
+
*/
|
|
31
|
+
export declare function materialClass(c: DensityConstruction | undefined): MaterialClass | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Density of a mixture of a copper jacket of mass share `jacketShare` (0 to 1) and a lead core,
|
|
34
|
+
* g/cm³: the volumes of the two add, 1 / (f / rho_Cu + (1 - f) / rho_Pb).
|
|
35
|
+
*/
|
|
36
|
+
export declare const jacketedDensity: (jacketShare: number) => number;
|
|
37
|
+
/**
|
|
38
|
+
* The highest density of each class, g/cm³. A jacketed bullet takes lead: a copper jacket is
|
|
39
|
+
* lighter than lead, so any jacket share lowers the mixture below it ({@link jacketedDensity}); the
|
|
40
|
+
* bound assumes no share (no source for one).
|
|
41
|
+
*/
|
|
42
|
+
export declare const materialDensityBound: Readonly<Record<MaterialClass, number>>;
|
|
43
|
+
/** The density a bullet's mass and outline imply, against the bound of its material class. */
|
|
44
|
+
export interface OutlineDensity {
|
|
45
|
+
/** Mass over the outline volume, g/cm³. */
|
|
46
|
+
density: number;
|
|
47
|
+
material: MaterialClass;
|
|
48
|
+
/** {@link materialDensityBound} of the class, g/cm³. */
|
|
49
|
+
bound: number;
|
|
50
|
+
/** The density lies above the bound: the outline is too small for the mass, or the record is wrong. */
|
|
51
|
+
exceeds: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The density a bullet record's mass and default outline imply (mass over the volume of
|
|
55
|
+
* `bulletOutline`, a cavity taken off), against the highest density of its material class.
|
|
56
|
+
* Undefined without a length, a diameter, an outline or a material class. A density above the bound
|
|
57
|
+
* means the outline undercounts the volume (a round or flat nose drawn too slim) or a record value
|
|
58
|
+
* is wrong.
|
|
59
|
+
*/
|
|
60
|
+
export declare function outlineDensity(r: BulletValues & {
|
|
61
|
+
mass: {
|
|
62
|
+
value: number;
|
|
63
|
+
};
|
|
64
|
+
construction?: DensityConstruction | undefined;
|
|
65
|
+
}): OutlineDensity | undefined;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { bulletOutline } from './outline.js';
|
|
2
|
+
import { bulletDimensions } from './profile.js';
|
|
3
|
+
/**
|
|
4
|
+
* Density of lead at 20 °C, g/cm³ (Wikipedia, "Lead", infobox, https://en.wikipedia.org/wiki/Lead,
|
|
5
|
+
* retrieved 2026-11-01).
|
|
6
|
+
*/
|
|
7
|
+
export const leadDensity = 11.348;
|
|
8
|
+
/**
|
|
9
|
+
* Density of copper at 20 °C, g/cm³ (Wikipedia, "Copper", infobox,
|
|
10
|
+
* https://en.wikipedia.org/wiki/Copper, retrieved 2026-11-01).
|
|
11
|
+
*/
|
|
12
|
+
export const copperDensity = 8.935;
|
|
13
|
+
const jacketedStructures = new Set(['cup-and-core', 'bonded', 'partitioned']);
|
|
14
|
+
const leadStructures = new Set(['cast', 'swaged', 'plated']);
|
|
15
|
+
const leadCores = new Set(['lead', 'lead-alloy']);
|
|
16
|
+
const copperCores = new Set(['copper', 'copper-alloy']);
|
|
17
|
+
/** The class of a core material: lead, copper, or another metal that settles no bound. */
|
|
18
|
+
const coreClass = (m) => {
|
|
19
|
+
if (m === undefined)
|
|
20
|
+
return;
|
|
21
|
+
if (leadCores.has(m))
|
|
22
|
+
return 'lead';
|
|
23
|
+
return copperCores.has(m) ? 'copper' : 'other';
|
|
24
|
+
};
|
|
25
|
+
/** The class the jacket or the structure states, none where they state none. */
|
|
26
|
+
function structureClass(c) {
|
|
27
|
+
const structure = c.structure ?? '';
|
|
28
|
+
if (c.jacket || jacketedStructures.has(structure))
|
|
29
|
+
return 'jacketed';
|
|
30
|
+
if (structure === 'monolithic')
|
|
31
|
+
return 'copper';
|
|
32
|
+
if (leadStructures.has(structure))
|
|
33
|
+
return 'lead';
|
|
34
|
+
}
|
|
35
|
+
/** The core each class goes with: a jacketed bullet has a lead core. */
|
|
36
|
+
const coreOf = {
|
|
37
|
+
jacketed: 'lead',
|
|
38
|
+
copper: 'copper',
|
|
39
|
+
lead: 'lead',
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The material class of a construction; undefined where it does not settle one, as for a core of
|
|
43
|
+
* another metal or a core that contradicts the structure.
|
|
44
|
+
*/
|
|
45
|
+
export function materialClass(c) {
|
|
46
|
+
if (!c || c.unmapped)
|
|
47
|
+
return;
|
|
48
|
+
const core = coreClass(c.core?.material);
|
|
49
|
+
if (core === 'other')
|
|
50
|
+
return;
|
|
51
|
+
const structure = structureClass(c);
|
|
52
|
+
if (!structure)
|
|
53
|
+
return core;
|
|
54
|
+
return core === undefined || core === coreOf[structure] ? structure : undefined;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Density of a mixture of a copper jacket of mass share `jacketShare` (0 to 1) and a lead core,
|
|
58
|
+
* g/cm³: the volumes of the two add, 1 / (f / rho_Cu + (1 - f) / rho_Pb).
|
|
59
|
+
*/
|
|
60
|
+
export const jacketedDensity = (jacketShare) => 1 / (jacketShare / copperDensity + (1 - jacketShare) / leadDensity);
|
|
61
|
+
/**
|
|
62
|
+
* The highest density of each class, g/cm³. A jacketed bullet takes lead: a copper jacket is
|
|
63
|
+
* lighter than lead, so any jacket share lowers the mixture below it ({@link jacketedDensity}); the
|
|
64
|
+
* bound assumes no share (no source for one).
|
|
65
|
+
*/
|
|
66
|
+
export const materialDensityBound = Object.freeze({
|
|
67
|
+
lead: leadDensity,
|
|
68
|
+
copper: copperDensity,
|
|
69
|
+
jacketed: leadDensity,
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* The density a bullet record's mass and default outline imply (mass over the volume of
|
|
73
|
+
* `bulletOutline`, a cavity taken off), against the highest density of its material class.
|
|
74
|
+
* Undefined without a length, a diameter, an outline or a material class. A density above the bound
|
|
75
|
+
* means the outline undercounts the volume (a round or flat nose drawn too slim) or a record value
|
|
76
|
+
* is wrong.
|
|
77
|
+
*/
|
|
78
|
+
export function outlineDensity(r) {
|
|
79
|
+
const material = materialClass(r.construction);
|
|
80
|
+
const shape = bulletDimensions(r);
|
|
81
|
+
if (!material || !shape)
|
|
82
|
+
return;
|
|
83
|
+
const o = bulletOutline(shape);
|
|
84
|
+
if ('reason' in o || !(o.volume > 0))
|
|
85
|
+
return;
|
|
86
|
+
// g over mm³ to g/cm³
|
|
87
|
+
const density = (r.mass.value / o.volume) * 1000;
|
|
88
|
+
const bound = materialDensityBound[material];
|
|
89
|
+
return { density, material, bound, exceeds: density > bound };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=density.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Medium, type ScaleBar } from '../core/layout.ts';
|
|
2
|
+
import type { Layout } from '../core/types.ts';
|
|
3
|
+
import type { LengthUnit } from '../core/units.ts';
|
|
4
|
+
import type { BulletProfile } from './profile.ts';
|
|
5
|
+
/** Everything one SVG of a bullet draws, in mm; paths in the part frame. */
|
|
6
|
+
export interface BulletModel {
|
|
7
|
+
medium: Medium;
|
|
8
|
+
em: number;
|
|
9
|
+
/** viewBox of the outer frame in mm: x, y, width, height. */
|
|
10
|
+
frame: [number, number, number, number];
|
|
11
|
+
bullet: {
|
|
12
|
+
section: string;
|
|
13
|
+
/** Strokes where the record gives the shape. */
|
|
14
|
+
outline: string;
|
|
15
|
+
/** Strokes where the outline assumed the shape. */
|
|
16
|
+
approximate: string;
|
|
17
|
+
edges: string;
|
|
18
|
+
};
|
|
19
|
+
axis: {
|
|
20
|
+
bullet: [number, number];
|
|
21
|
+
};
|
|
22
|
+
layers: {
|
|
23
|
+
bullet: Layout;
|
|
24
|
+
};
|
|
25
|
+
scale: ScaleBar;
|
|
26
|
+
details: never[];
|
|
27
|
+
}
|
|
28
|
+
/** The smallest text size of at least 1.8 mm that renders 11 CSS px in the 358 px phone column. */
|
|
29
|
+
export declare const bulletScreenEm: (p: BulletProfile, unit?: LengthUnit) => number;
|
|
30
|
+
/**
|
|
31
|
+
* The model of one SVG of a bullet at text size em, at least `across` mm wide on the medium, its
|
|
32
|
+
* length texts in `unit`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function bulletFigureModel(p: BulletProfile, medium: Medium, em: number, across?: number, unit?: LengthUnit): BulletModel;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { annotate } from '../core/annotate.js';
|
|
2
|
+
import { layoutCache } from '../core/cache.js';
|
|
3
|
+
import { axisReach, figureFrame, fitEm, frameWidth, readingDirection, } from '../core/layout.js';
|
|
4
|
+
import { edgeLines, fullSection, svgPath, toPartFrame as toFrame } from '../core/section.js';
|
|
5
|
+
/** The profile laid out at text size em, once per profile, medium, size and unit. */
|
|
6
|
+
const laid = layoutCache((p, medium, em, unit) => {
|
|
7
|
+
const axis = axisReach(p);
|
|
8
|
+
const layout = annotate({ points: p.points, annotation: p.annotation, unit, fixedDecimals: true }, em, readingDirection(medium), axis);
|
|
9
|
+
const b = layout.box;
|
|
10
|
+
const box = [
|
|
11
|
+
Math.min(b[0], axis[0]),
|
|
12
|
+
Math.min(b[1], 0),
|
|
13
|
+
Math.max(b[2], axis[1]),
|
|
14
|
+
Math.max(b[3], 0),
|
|
15
|
+
];
|
|
16
|
+
return { layout, axis, box };
|
|
17
|
+
});
|
|
18
|
+
/** The smallest text size of at least 1.8 mm that renders 11 CSS px in the 358 px phone column. */
|
|
19
|
+
export const bulletScreenEm = (p, unit = 'mm') => fitEm((em) => frameWidth(laid(p, 'screen', em, unit).box, 'screen', em, unit));
|
|
20
|
+
/**
|
|
21
|
+
* The model of one SVG of a bullet at text size em, at least `across` mm wide on the medium, its
|
|
22
|
+
* length texts in `unit`.
|
|
23
|
+
*/
|
|
24
|
+
export function bulletFigureModel(p, medium, em, across = 0, unit = 'mm') {
|
|
25
|
+
const { layout, axis, box } = laid(p, medium, em, unit);
|
|
26
|
+
const { frame, scale } = figureFrame(box, medium, em, across, unit);
|
|
27
|
+
const strokes = (approximate) => p.outline.segments
|
|
28
|
+
.filter((s) => s.approximate === approximate)
|
|
29
|
+
.map((s) => svgPath(toFrame(s.points)) + svgPath(toFrame(s.points, -1)))
|
|
30
|
+
.join('');
|
|
31
|
+
const rMax = Math.max(...p.points.map(([r]) => r));
|
|
32
|
+
return {
|
|
33
|
+
medium,
|
|
34
|
+
em,
|
|
35
|
+
frame,
|
|
36
|
+
bullet: {
|
|
37
|
+
section: svgPath(fullSection(p.points), true),
|
|
38
|
+
outline: strokes(false),
|
|
39
|
+
approximate: strokes(true),
|
|
40
|
+
edges: edgeLines(p.annotation.edges, rMax)
|
|
41
|
+
.map((l) => svgPath(l))
|
|
42
|
+
.join(''),
|
|
43
|
+
},
|
|
44
|
+
axis: { bullet: axis },
|
|
45
|
+
layers: { bullet: layout },
|
|
46
|
+
scale,
|
|
47
|
+
details: [],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=figure.js.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { SectionPoint } from '../core/types.ts';
|
|
2
|
+
import { type LengthUnit } from '../core/units.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Where an outline point comes from: `sourced` (a record value) or `entered` (a designer value)
|
|
5
|
+
* when both coordinates are given values, `derived` when computed from given values only,
|
|
6
|
+
* `approximate` once a stated proportion stands in for a missing value.
|
|
7
|
+
*/
|
|
8
|
+
export type Tag = 'sourced' | 'entered' | 'derived' | 'approximate';
|
|
9
|
+
/** The base types: a hollow base has a cone or a hemisphere cut into its base face. */
|
|
10
|
+
export type BaseType = 'flat' | 'boat-tail' | 'rebated-boat-tail' | 'conical-hollow-base' | 'rounded-hollow-base';
|
|
11
|
+
/** Bullet dimensions, mm and degrees: the record fields of the same names, plain numbers. */
|
|
12
|
+
export interface BulletDimensions {
|
|
13
|
+
diameter: number;
|
|
14
|
+
length: number;
|
|
15
|
+
noseLength?: number | undefined;
|
|
16
|
+
baseToOgive?: number | undefined;
|
|
17
|
+
bearingLength?: number | undefined;
|
|
18
|
+
/** 0 for a sharp point. */
|
|
19
|
+
meplatDiameter?: number | undefined;
|
|
20
|
+
base?: {
|
|
21
|
+
type?: BaseType | undefined;
|
|
22
|
+
length?: number | undefined;
|
|
23
|
+
/** Diameter of the base face at the end of the boat tail. */
|
|
24
|
+
diameter?: number | undefined;
|
|
25
|
+
/** Half angle of the boat-tail cone to the axis. */
|
|
26
|
+
angle?: number | undefined;
|
|
27
|
+
/** Diameter of the cavity of a hollow base where it opens in the base face. */
|
|
28
|
+
cavityDiameter?: number | undefined;
|
|
29
|
+
/** Depth of the cavity of a hollow base from the base face, measured or typed; without it the depth is assumed. */
|
|
30
|
+
cavityDepth?: number | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* `form`: `tangent`, `secant`, `hybrid`, or for designer input `round-nose` and `flat-nose`.
|
|
34
|
+
* `radius` is the ogive radius R; `radiusRatio` is Rt/R (1 tangent, 0 a cone).
|
|
35
|
+
*/
|
|
36
|
+
ogive?: {
|
|
37
|
+
form?: string | undefined;
|
|
38
|
+
radius?: number | undefined;
|
|
39
|
+
radiusRatio?: number | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/** `length`: polymer tip forward of the jacket opening; `mouthDiameter`: hollow-point opening. */
|
|
42
|
+
tip?: {
|
|
43
|
+
type: string;
|
|
44
|
+
length?: number | undefined;
|
|
45
|
+
mouthDiameter?: number | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* `start` is the z of the groove's rear edge from the base, `width` its axial width, `depth`
|
|
49
|
+
* its radial depth.
|
|
50
|
+
*/
|
|
51
|
+
cannelure?: {
|
|
52
|
+
start: number;
|
|
53
|
+
width: number;
|
|
54
|
+
depth?: number | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Why input cannot form an outline, and the record paths of the fields involved. */
|
|
58
|
+
export interface Refusal {
|
|
59
|
+
reason: string;
|
|
60
|
+
fields: string[];
|
|
61
|
+
}
|
|
62
|
+
/** The half profile of a bullet with the quantities derived from it, in mm, mm², mm³ and degrees. */
|
|
63
|
+
export interface Outline {
|
|
64
|
+
/**
|
|
65
|
+
* Half profile [r, z] to the tip on the axis, closed along the axis. It starts at the base
|
|
66
|
+
* center (z = 0), or at the apex of a hollow base's cavity, which the profile follows down to the
|
|
67
|
+
* base face (`baseEdge`); from there z never falls.
|
|
68
|
+
*/
|
|
69
|
+
points: SectionPoint[];
|
|
70
|
+
/** The tag of each point of `points`. */
|
|
71
|
+
tags: Tag[];
|
|
72
|
+
/** Stroked runs of the outline; approximate ones rest on an assumed shape. */
|
|
73
|
+
segments: {
|
|
74
|
+
points: SectionPoint[];
|
|
75
|
+
approximate: boolean;
|
|
76
|
+
}[];
|
|
77
|
+
/** z ranges of the outline drawn from an assumed shape, the cavity of a hollow base apart. */
|
|
78
|
+
approximate: [number, number][];
|
|
79
|
+
/** Index in `points` of the edge of the base face. */
|
|
80
|
+
baseEdge: number;
|
|
81
|
+
/**
|
|
82
|
+
* The cavity of a hollow base: its radius at the base face and its depth, assumed unless `typed`
|
|
83
|
+
* (a depth the input gives).
|
|
84
|
+
*/
|
|
85
|
+
cavity?: {
|
|
86
|
+
radius: number;
|
|
87
|
+
depth: number;
|
|
88
|
+
typed: boolean;
|
|
89
|
+
};
|
|
90
|
+
noseLength: number;
|
|
91
|
+
noseAssumed: boolean;
|
|
92
|
+
/** Shank length between the boat tail and the nose, mm. */
|
|
93
|
+
bearingLength: number;
|
|
94
|
+
/** Volume of revolution, mm³, less the cavity. */
|
|
95
|
+
volume: number;
|
|
96
|
+
/** Area of the full axial section, mm². */
|
|
97
|
+
area: number;
|
|
98
|
+
/** z of the center of the section area, mm. */
|
|
99
|
+
areaCentreZ: number;
|
|
100
|
+
/** z where a polymer tip leaves the jacket. */
|
|
101
|
+
tipStart?: number;
|
|
102
|
+
notes: string[];
|
|
103
|
+
}
|
|
104
|
+
/** Assumed boat-tail half angle, degrees, when the bullet gives only the tail length. */
|
|
105
|
+
export declare const assumedBoatTailAngle = 8;
|
|
106
|
+
/** Twice the signed area of the triangle p, q, s. */
|
|
107
|
+
export declare const triangleArea2: (p: SectionPoint, q: SectionPoint, s: SectionPoint) => number;
|
|
108
|
+
/** Whether the half profile, closed along the axis, crosses or touches itself away from shared corners. */
|
|
109
|
+
export declare function profileCrossesItself(points: SectionPoint[]): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Bullet outline from the given dimensions; stated proportions stand in for missing ones and
|
|
112
|
+
* are named in the notes. Input that cannot form an outline returns a reason. Ogive radius and
|
|
113
|
+
* Rt/R as defined by McCoy, ARBRL-TR-02293, 1981, PDF p. 13. A refusal and the notes write their
|
|
114
|
+
* lengths in `unit`.
|
|
115
|
+
*/
|
|
116
|
+
export declare function bulletOutline(b: BulletDimensions, given?: 'sourced' | 'entered', unit?: LengthUnit): Outline | Refusal;
|
|
117
|
+
/**
|
|
118
|
+
* The bracket of the depth of a cavity whose depth is not given, as multiples of its radius: half
|
|
119
|
+
* to three times the assumed depth. An assumption without a source (no maker publishes a depth).
|
|
120
|
+
*/
|
|
121
|
+
export declare const cavityDepthBracket: Readonly<{
|
|
122
|
+
low: 0.5;
|
|
123
|
+
high: 3;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Volume of the solid of revolution of a half profile closed along the axis, from z = 0 to `cut`,
|
|
127
|
+
* mm³: each segment adds its frustum going up and takes it off going down, so the wall of a
|
|
128
|
+
* cavity subtracts.
|
|
129
|
+
*/
|
|
130
|
+
export declare function revolutionVolume(points: SectionPoint[], cut: number): number;
|
|
131
|
+
/**
|
|
132
|
+
* The bullet volume below `cut` mm, mm³, with the cavity of a hollow base at the ends of
|
|
133
|
+
* {@link cavityDepthBracket}: `low` with the deepest cavity, `high` with the shallowest. Undefined
|
|
134
|
+
* without a cavity of assumed depth, with nothing below the cut, or when a bracket depth gives no
|
|
135
|
+
* outline. A deepest cavity that would reach the length is held just below it; one that would cut
|
|
136
|
+
* through the wall (a boat tail, a short shank) is made shallower, to the deepest depth whose
|
|
137
|
+
* outline holds (bisection down to the assumed depth).
|
|
138
|
+
*/
|
|
139
|
+
export declare function cavityVolumeBracket(b: BulletDimensions, cut: number): {
|
|
140
|
+
low: number;
|
|
141
|
+
high: number;
|
|
142
|
+
} | undefined;
|
|
143
|
+
/** Whether the bullet below `cut` mm rests on an assumed shape: an assumed range or a cavity of assumed depth. */
|
|
144
|
+
export declare const assumedBelow: (o: Outline, cut: number) => boolean;
|