diff --git a/HISTORY.md b/HISTORY.md index 766144c..af9c2d2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](/~https://github.com/CookPete/auto-changelog). +## [v2.2.0](/~https://github.com/jcw780/wows_ballistics/compare/v2.1.1...v2.2.0) - 2020-07-31 + +### Commits + +- added dispersion charts [`41e6d00`](/~https://github.com/jcw780/wows_ballistics/commit/41e6d00610ce77b5a40c965510a22bbb81eeb92f) +- feature: added dispersion parameters; separated charts with <hr/> [`a4cc5bd`](/~https://github.com/jcw780/wows_ballistics/commit/a4cc5bd1e06ebe25800bc889ccd08ffe42d35a1b) +- refactored shellForms.getDefaultData; pass dispersion parameters into formData [`88fab0c`](/~https://github.com/jcw780/wows_ballistics/commit/88fab0c4ee54bc1ff909ac3c5b400097a4fb2575) +- feature: added tooltips for understood parameters [`bfe31ee`](/~https://github.com/jcw780/wows_ballistics/commit/bfe31eed7c6dab5de75ad7f7342b327eefc6f51d) +- update version [`17d3d18`](/~https://github.com/jcw780/wows_ballistics/commit/17d3d18a93c53a4304a7a058049553132df4288a) +- pass dispersion parameters to shellForms [`763e85b`](/~https://github.com/jcw780/wows_ballistics/commit/763e85b700f15f7bd0d00dd9f35345e7b32af9e8) +- fix: bug where dispersion charts do not update [`24081cf`](/~https://github.com/jcw780/wows_ballistics/commit/24081cfbc729fd079f88e2e30d6825653301cbd1) +- Update README.md [`9886684`](/~https://github.com/jcw780/wows_ballistics/commit/988668484526734574985cff2a099d339d204dbb) +- feature: added dispersion charts to initalData [`97d1ef4`](/~https://github.com/jcw780/wows_ballistics/commit/97d1ef4a2626dc34438b30779b470f560de15028) + ## [v2.1.1](/~https://github.com/jcw780/wows_ballistics/compare/v2.1.0...v2.1.1) - 2020-07-30 ### Commits diff --git a/README.md b/README.md index 9ae9b63..28d6e1a 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ ### Calculate AP performance post penetration - Shell detonation distance after penetration - Checking whether the armor is thick enough to arm the shell +### Predict Ship Dispersion *Experimental* +- Predicts maximum and standard deviation of horizontal dispersion +- Predicts maximum and standard deviation of vertical dispersion ## Development Status - [Issues](/~https://github.com/jcw780/wows_ballistics/issues) - Feel free to open an issue for questions, bugs, feature requests etc. @@ -35,7 +38,6 @@ - Calculations may be refined if contradicting data is provided ### Future Features - Multiple Targets -- Dispersion? diff --git a/package.json b/package.json index 7990bfe..37c3076 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wows_ballistics", - "version": "2.1.1", + "version": "2.2.0", "private": true, "homepage": "http://jcw780.github.io/wows_ballistics", "dependencies": { diff --git a/src/components/App.tsx b/src/components/App.tsx index c28a1ca..a924046 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -26,6 +26,7 @@ class App extends React.Component<{},{}> { impact : [], angle : [], post : [], + dispersion: [], }); // Wasm @@ -90,6 +91,12 @@ class App extends React.Component<{},{}> { notFused: [], fused: [], }, + dispersion: { + horizontal: [], + horizontalStd: [], + vertical: [], + verticalStd: [], + }, numShells : 2, names : [], colors : [], targets : Array(1), angles : [], refAngles : [], refLabels : [], @@ -199,18 +206,76 @@ class App extends React.Component<{},{}> { for(let j=0; j taperDist){ + maxDispersion = hSlope * distKm + hConst; + }else{ + maxDispersion = taperSlope * distKm; + } + calculatedData.dispersion.horizontal[j].push({ + x: dist, y: maxDispersion + }); + calculatedData.dispersion.horizontalStd[j].push({ + x: dist, y: maxDispersion / sigma + }); + let maxVertical = maxDispersion / + Math.sin(this.instance.getImpactPoint(i, arrayIndices.impactDataIndex.impactAHR, j) * - 1); + if(distKm < delimSplit){ + maxVertical *= (zdSlope * distKm + zdConst); + }else{ + maxVertical *= (dmSlope * distKm + dmConst); + } + calculatedData.dispersion.vertical[j].push({ + x: dist, y: maxVertical + }); + calculatedData.dispersion.verticalStd[j].push({ + x: dist, y: maxVertical / sigma + }); + + + /*Impact*/this.makeImpactPoints(j, i, dist); /*Angle*/this.makeAnglePoints(j, i, dist); + //Post-Pen for(let k=0; k{ React.createRef(), ''], [{data: {datasets : Array(),}, options: {}}, React.createRef(), ''], + ], + dispersion: [ + [{data: {datasets : Array(),}, options: {}}, + React.createRef(), '**Experimental** Horizontal Dispersion'], + [{data: {datasets : Array(),}, options: {}}, + React.createRef(), '**Experimental** Vertical Dispersion'], ] } groupRefs = { @@ -286,6 +292,7 @@ export class ChartGroup extends React.Component{ Time: (x, y) => {return `(${x}m, ${y}s)`;}, angle: (x, y) => {return `(${x}m, ${y}°)`;}, detDist: (x, y) => {return `(${x}m, ${y}m)`;}, + dispersion: (x, y) => {return `(${x}m, ${y}m)`;}, } constructor(props){ @@ -356,7 +363,7 @@ export class ChartGroup extends React.Component{ const targetInclination = `Vertical Inclination: ${graphData.targets[0].inclination}°`; //Static Charts [Never changes in number] - const staticChartTypes = Object.freeze(['impact', 'angle']); + const staticChartTypes = Object.freeze(['impact', 'angle', 'dispersion']); //Impact Charts const configImpact = this.chartConfigs.impact; const setupImpact = (row : configsT) => { @@ -393,9 +400,24 @@ export class ChartGroup extends React.Component{ } const angleNameTemplate = (name: string) : string => `${name} | ${targetedArmor} | ${targetInclination}`; + //Dispersion Charts + const configDispersion = this.chartConfigs.dispersion; + const setupDispersion = (row : configsT) => { + return { + title: {display: true, text: row.title}, + scales: {xAxes: xAxesDistance, + yAxes: [{id: "dispersion", postition: "left", + scaleLabel: {display: true, labelString: "Dispersion (m)",}, + ticks:{min: 0} + }] + }, + legend: legend, + tooltips: {callbacks: {label: this.callbackFunction, labelColor: this.callbackColor}}, + } + } //Colons are used to denote split between label and name - const staticOptionSetup : Record<'impact' | 'angle', [(configsT) => any, configsT[]]> = Object.freeze({ + const staticOptionSetup : Record<'impact' | 'angle' | 'dispersion', [(configsT) => any, configsT[]]> = Object.freeze({ impact: [setupImpact, [ {title: configImpact[0][singleChartIndex.name], axes: [ @@ -442,6 +464,24 @@ export class ChartGroup extends React.Component{ ]} ] ], + dispersion: [setupDispersion, + [ + {title: configDispersion[0][singleChartIndex.name], axes: [ + {id: 'dispersion', + lines: [ + {lineLabel: 'Max: ', data: 'horizontal'}, + {lineLabel: 'Std: ', data: 'horizontalStd'}, + ]}, + ]}, + {title: configDispersion[1][singleChartIndex.name], axes: [ + {id: 'dispersion', + lines: [ + {lineLabel: 'Max: ', data: 'vertical'}, + {lineLabel: 'Std: ', data: 'verticalStd'}, + ]}, + ]}, + ] + ] }); //Post-Penetration Charts @@ -486,21 +526,23 @@ export class ChartGroup extends React.Component{ const assignPredefined = (shellIndex: number, name: string, target, configs : configsT[], graphData, colors : string[]) => { - for(const [rowIndex, chart] of target.entries()){ - let counter = 0; - const CRA = configs[rowIndex].axes.entries(); - for(const[, axis] of CRA){ - const ALE = axis.lines.entries(); - for(const[, line] of ALE){ - chart[singleChartIndex.config].data.datasets.push(addLine( - graphData[line.data][shellIndex], - line.lineLabel + name, - axis.id, - colors[counter])); - counter++; + if(graphData !== undefined){ + for(const [rowIndex, chart] of target.entries()){ + let counter = 0; + const CRA = configs[rowIndex].axes.entries(); + for(const[, axis] of CRA){ + const ALE = axis.lines.entries(); + for(const[, line] of ALE){ + chart[singleChartIndex.config].data.datasets.push(addLine( + graphData[line.data][shellIndex], + line.lineLabel + name, + axis.id, + colors[counter])); + counter++; + } } - } - } + } + } } const generateStatic = (i : number, name : string, colors : string[]) => { @@ -641,11 +683,15 @@ export class ChartGroup extends React.Component{ for(const [, chart] of this.chartConfigs.angle.entries()){ injectData(chart); } + for(const [, chart] of this.chartConfigs.dispersion.entries()){ + injectData(chart); + } //Update Charts if(forceUpdate){ //For disabling rerender in constructor [will be rendered anyways] this.updateCharts('impact'); //Only need to update charts not surrounding components this.updateCharts('angle'); + this.updateCharts('dispersion'); if(updatePost){ this.updateCharts('post'); }else{ @@ -697,6 +743,7 @@ export class ChartGroup extends React.Component{ {this.addChart('impact')} +
Shows at what target angles and ranges shells will:
@@ -712,6 +759,7 @@ export class ChartGroup extends React.Component{
{this.addChart('angle')} +
Show how far shells would travel into a ship after penetrating armor.
@@ -728,6 +776,22 @@ export class ChartGroup extends React.Component{
{this.addChart('post')} +
+ + Predicts maximum and standard deviation of dispersion.
+ - Horizontal Axis
+ - Vertical Axis
+ *Note: Still experimental - results may differ from the game
+ and will be corrected if errors are reported + + }> +
+

**Experimental** Dispersion Charts

+ +
+
+ {this.addChart('dispersion')} ); } diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx index fb789f5..a39ebed 100644 --- a/src/components/Navbar/Navbar.tsx +++ b/src/components/Navbar/Navbar.tsx @@ -64,6 +64,11 @@ export class NavbarCustom extends React.Component<{links: T.linkT}>{ links={links['post']} ref={this.navDropdownContainers[3]} /> +