fix: close California play and asset acceptance gaps
This commit is contained in:
@@ -24,6 +24,8 @@ describe("procedural electric aircraft", () => {
|
||||
it("builds an original metre-scale fixed wing facing -Z with articulated parts", () => {
|
||||
const rig = buildElectricAircraft();
|
||||
assert.equal(rig.root.name, "electric-aircraft");
|
||||
assert.equal(rig.root.userData.forwardAxis, "-Z");
|
||||
assert.equal(rig.root.userData.aircraftModel, "electric-vtail");
|
||||
assert.equal(rig.fans.length, 2);
|
||||
assert.equal(rig.ownsMaterials, true);
|
||||
assert.ok(ELECTRIC_AIRCRAFT_METRICS.wingspan > ELECTRIC_AIRCRAFT_METRICS.length);
|
||||
@@ -32,10 +34,36 @@ describe("procedural electric aircraft", () => {
|
||||
assert.ok(size.x > 10);
|
||||
assert.ok(size.z > 7);
|
||||
assert.ok(size.y > 1.5);
|
||||
assert.ok(rig.leftAileron.position.z <= 0.6, "left aileron remains attached to tapered trailing edge");
|
||||
assert.ok(rig.rightAileron.position.z <= 0.6, "right aileron remains attached to tapered trailing edge");
|
||||
const wing = rig.root.getObjectByName("electric-aircraft:wing");
|
||||
assert.ok(wing instanceof THREE.Mesh);
|
||||
const normals = wing.geometry.getAttribute("normal");
|
||||
assert.ok(normals && Array.from({ length: normals.count }, (_, index) => normals.getY(index)).every((y) => y > 0),
|
||||
"wing front faces point toward the chase/flyover camera");
|
||||
disposeElectricAircraft(rig);
|
||||
assert.equal(rig.root.children.length, 0);
|
||||
});
|
||||
|
||||
it("distributes every fan blade evenly around its hub", () => {
|
||||
const rig = buildElectricAircraft();
|
||||
for (const fan of rig.fans) {
|
||||
const blades = fan.children.filter((child) => child.name.includes(":blade-"));
|
||||
assert.equal(blades.length, 5);
|
||||
const centroid = blades.reduce(
|
||||
(sum, blade) => sum.add(blade.position),
|
||||
new THREE.Vector3(),
|
||||
).multiplyScalar(1 / blades.length);
|
||||
assert.ok(centroid.length() < 1e-12, `fan centroid ${centroid.toArray()}`);
|
||||
for (const blade of blades) {
|
||||
assert.ok(Math.abs(blade.position.length() - 0.3) < 1e-12);
|
||||
const radial = new THREE.Vector3(0, 1, 0).applyQuaternion(blade.quaternion);
|
||||
assert.ok(radial.angleTo(blade.position.clone().normalize()) < 1e-7);
|
||||
}
|
||||
}
|
||||
disposeElectricAircraft(rig);
|
||||
});
|
||||
|
||||
it("animates opposing ailerons, V-tail surfaces, and electric fans", () => {
|
||||
const rig = buildElectricAircraft();
|
||||
setAircraftControlSurfaces(rig, { roll: 0.8, pitch: 0.5, yaw: -0.4 });
|
||||
@@ -174,6 +202,12 @@ describe("aircraft controller", () => {
|
||||
assert.throws(() => new AircraftController({
|
||||
route: [{ id: "bad", lat: Number.NaN, lng: 0, altitudeM: 1_000 }],
|
||||
}), /waypoints/);
|
||||
assert.throws(() => new AircraftController({
|
||||
route: [{ id: "outside-california", lat: 45, lng: -118, altitudeM: 1_000 }],
|
||||
}), /waypoints/);
|
||||
assert.throws(() => new AircraftController({
|
||||
route: [{ id: "above-envelope", lat: 37, lng: -122, altitudeM: 8_000 }],
|
||||
}), /waypoints/);
|
||||
assert.throws(() => new AircraftController({
|
||||
envelope: {
|
||||
minLat: 40,
|
||||
|
||||
Reference in New Issue
Block a user