载入中...
搜索中...
未找到
WingAssembly.cpp
浏览该文件的文档.
17 return isFinite(v) && std::abs(v.x) <= limit && std::abs(v.y) <= limit && std::abs(v.z) <= limit;
24 const auto v = b3RotateVector(b3Quat{body.getRotX(), body.getRotY(), body.getRotZ(), body.getRotW()},
33 const auto v = b3RotateVector(b3Quat{body.getRotX(), body.getRotY(), body.getRotZ(), body.getRotW()},
42 const ForceVector r{p.x - body.getWorldCenterX(), p.y - body.getWorldCenterY(), p.z - body.getWorldCenterZ()};
43 const ForceVector w{body.getAngularVelocityX(), body.getAngularVelocityY(), body.getAngularVelocityZ()};
44 return {body.getLinearVelocityX() + w.y * r.z - w.z * r.y, body.getLinearVelocityY() + w.z * r.x - w.x * r.z,
48Result<ForceBatch> prepareSurfaces(W& world, PhysicsLink link, std::span<const WingSurface> surfaces,
51 if (controls.size() != surfaces.size() || !isFinite(wind) || (planar && wind.z != 0)) return invalid<ForceBatch>();
61 (planar && (surface.center.z != 0 || surface.model.chord.z != 0 || surface.model.normal.z != 0)))
66 model.chord = direction(body, add(scale(surface.model.chord, c), scale(surface.model.normal, s)));
67 model.normal = direction(body, add(scale(surface.model.normal, c), scale(surface.model.chord, -s)));
86Result<ForceBatch> WingAssembly::prepare(World& world, PhysicsLink body, std::span<const double> controls,
90Result<ForceBatch> WingAssembly::prepare(World3D& world, PhysicsLink body, std::span<const double> controls,
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Result< ForceBatch > prepare(World &world, std::span< const ForceLoad > loads)
Validate and copy planar requests without waking or applying forces.
Definition ForceBatch.cpp:76
static Result< WingSample > wing(const WingModel &model, ForceVector relativeVelocity)
Wing force using body-minus-air velocity at the aerodynamic center.
Definition Aerodynamics.cpp:40
Immutable multi-surface aerodynamics, producing a single external-force batch. @ownership Copies geom...
Definition WingAssembly.h:23
static Result< WingAssembly > build(std::span< const WingSurface > surfaces)
Validate and copy local surface descriptions in deterministic input order.
Definition WingAssembly.cpp:78
Result< ForceBatch > prepare(World &world, PhysicsLink body, std::span< const double > deflections, ForceVector wind) const
Prepare planar surface forces; centers, local axes and wind must have z=0.
Definition WingAssembly.cpp:86
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:47
Box2D world wrapper (2D physics) with pixel-space coordinates. Handles stepping, gravity,...
Definition World.h:44
ForceVector add(ForceVector a, ForceVector b)
Definition ForceMath.h:13
Owning world-space SI vector; 2D uses XY with Z exactly zero.
Definition ForceModels.h:12
eve::ResultRef< Joint2D > resolve(World &world) const
Borrow a planar joint synchronously on its simulation thread; stale owner/generation rejects.
Definition Joint2D.cpp:300
Generation-qualified relationship between one world and one body.
Definition PhysicsLink.h:35