# Wing A wing panel for an RC model, a printed glider or a drone's fixed wing: airfoil sections (NACA four- or five-digit, Clark Y, or coordinates pasted from a `.dat` file, the root's blending into the tip's) on a rectangular, tapered, centre + taper or elliptic planform, with sweep, dihedral, incidence and washout. Solid, or a skin over ribs with lightening holes, and an aileron (or a flap) cut free behind a hinge line. A right panel, its mirror image for the left, or the full span. A spar or a servo bay is a sketch and a cut after it (below). ```js import { wing } from '@fluidcad/airfoils'; ``` ## Use ```js // One panel of a 1.2 m trainer wing, printed: tapered NACA 2412 into 2410, // a skin over seven ribs and an aileron. wing({ span: 600, rootChord: 200, tipChord: 140, dihedral: 3, washout: 2.5, naca: "2412", tipAirfoil: "naca", tipNaca: "2410", structure: "shell", ribs: 7, aileron: true, aileronFrom: 48, aileronTo: 94, hingeAt: 76, }); // The same panel for the other side. wing({ panel: "left", span: 600, rootChord: 200, tipChord: 140 /* , … */ }); // A one-piece wing, tip to tip, on the origin. wing({ panel: "both", planform: "centre", span: 450, rootChord: 180, tipChord: 120, airfoil: "clarky" }); // Its root on a fuselage's side face, the span out along the face's normal, // fused into the fuselage. wing(body.sideFaces(face().onPlane("xz", -30)), { span: 300, rootChord: 140, tipChord: 90 }); ``` `wing(at, { panel, planform, span, rootChord, tipChord, breakAt, sweep, dihedral, incidence, washout, airfoil, naca, thickness, dat, tipAirfoil, tipNaca, tipThickness, tipDat, trailingEdge, structure, skin, ribs, ribThickness, lightening, holeSize, aileron, aileronFrom, aileronTo, hingeAt, hingeGap, keepAileron, offset, phase })`. It adds by default (`.new()` keeps it a body of its own). **Where it stands.** In its own frame the chord runs aft along X from the root's leading edge, the span out along Y, and Z is up. Left out, `at` puts the root on the XZ plane at the origin, the span along +Y (a left panel's along −Y). On a planar face the root lies on the face, the span runs out along its normal, and up is the face's Y (world up, made square to the face), so a wing on a fuselage's side stands upright and its chord runs across the face. On a connector or an axis it takes their frame. **A spar, a servo bay.** Draw them and cut them after the wing; they vary too much between models to be its values. A spar follows the dihedral: sketch its section on the root's plane turned up by the dihedral, set a little behind the root so it opens cleanly through it, and cut out along that plane's normal. A servo pocket is a sketch under the wing, cut up into it. In a ribbed shell a plain cut opens into the hollow bay it reaches: a spar bears in the ribs it crosses (each rib is whole across its deepest part, where a spar goes), but a pocket has no walls or floor of its own, so model them when the servo needs them. The README has both, sketched and cut. ## Values | Value | Default | What it does | |---|---|---| | `panel` | `"right"` | `"right"`, `"left"` (the right panel's mirror image) or `"both"` (both, joined at the root). | | `planform` | `"tapered"` | `"rectangle"`, `"tapered"`, `"centre"` (constant chord out to `breakAt`, then tapered) or `"elliptic"` (closing at the tip, its quarter-chord line straight). | | `span` | 400 | The panel's, root to tip. A full-span wing is twice it. | | `rootChord`, `tipChord` | 160, 110 | The chords; `tipChord` for tapered and centre + taper planforms. | | `breakAt` | 40 | Centre + taper: how far out the constant-chord centre runs, % of the span. | | `sweep` | 0 | Degrees, the **quarter-chord line's**, back from square to the root. | | `dihedral` | 3 | Degrees, the tip raised. Sections stay streamwise (parallel to the root). | | `incidence` | 0 | Degrees, the root's angle of attack, nose up. | | `washout` | 2 | Degrees the tip is twisted nose down, about the quarter chord; over the outer panel only on a centre + taper wing. | | `airfoil` | `"naca"` | `"naca"`, `"clarky"` or `"dat"`. | | `naca` | `"2412"` | A NACA designation: four digits, or five (`23012`; `23112` reflexed). | | `thickness` | 11.7 | A Clark Y's thickness, %. | | `dat` | `""` | Airfoil coordinates, Selig or Lednicer `.dat`, as one string with `\n` between lines. Coordinates over the chord (x from 0 to 1) are kept as given; others are set square. | | `tipAirfoil`, `tipNaca`, `tipThickness`, `tipDat` | `"same"`, … | The tip's airfoil (`"same"` as the root's); the root's blends into it along the span. | | `trailingEdge` | 0.4 | The trailing edge's thickness at least, a length. | | `structure` | `"solid"` | `"solid"` or `"shell"` (a skin over ribs). | | `skin`, `ribs`, `ribThickness` | 0.8, 6, 1.2 | The shell's skin, its ribs (root and tip ribs counted, evenly spaced) and their thickness. | | `lightening`, `holeSize` | `true`, 60 | Holes in the ribs between the root's and the tip's, each `holeSize` % of the rib's depth where it stands, clear of the rib's deepest part (a sixth of the chord round its thickest point, left whole for a spar) and of the hinge web. | | `aileron` | `false` | An aileron (or a flap). | | `aileronFrom`, `aileronTo` | 50, 92 | Its ends, % of the span. | | `hingeAt` | 75 | The hinge line, % of the chord at both ends; straight between. | | `hingeGap` | 0.6 | The gap round the aileron, square to its edges. | | `keepAileron` | `true` | Keep the aileron as a body of its own; off, it is cut away. | | `offset` | 0 | Along the span: below 0 sinks the root in. | | `phase` | 0 | Degrees: turns the wing about its span, to line its chord up on the face. | A ribbed shell's void stops short where the sections grow too thin for two skins (an elliptic tip): its tip rib stands there and the wing is solid out to the tip. ## Frames | Frame | Where it is | |---|---| | `root` | Origin at the root's leading edge. Z out of the root, against the span; X and Y those of a face the root stands on, so up is against Y. `phase` and `offset` move the wing on the frame, never the frame. On a full-span wing it lies on the centre section. | `connector("root", w.frame("root"))` makes it a connector in a part file. ## Buckets | Bucket | What it holds | |---|---| | `startFaces` | The root face (none on a full-span wing). | | `endFaces` | The tip face (none on an elliptic wing, which closes to a point). | | `sideFaces` | The skins, upper and lower, the trailing edge, the faces either side of the aileron's gap, and the aileron's own skins. | | `internalFaces` | Inside a shell: the bays' walls (the skins' insides and the ribs' faces) and the lightening holes. | | `hingeFaces` | The faces either side of the gap round the aileron: the wing's hinge face and the ends of its aileron cut-out, the aileron's front face and its ends. | | `aileronFaces` | Every face of the aileron (both, on a full-span wing). | ## As a part `wingPart` is the wing as a part an assembly inserts, with the same values by id (all but `at`: the assembly places it) and the same dialog, under **Generate Parts**: ```js import { wingPart } from '@fluidcad/airfoils'; const left = insert(wingPart, { span: 600, rootChord: 200, tipChord: 140, panel: "left" }); mate("fastened", fuselage.connectors.leftSide, left.connectors.root); ``` | Connector | Where it is | |---|---| | `root` | The `root` frame. A plain mate on a connector pointing out of a fuselage's side seats the root on it as `wing(face, …)` stands on that face, upright when the connector's Y is up, with no `.flip()`. |