载入中...
搜索中...
未找到
Rope3DTopology.cpp
浏览该文件的文档.
8Rope3D::Vec3 subtract(Rope3D::Vec3 a, Rope3D::Vec3 b) { return {a.x - b.x, a.y - b.y, a.z - b.z}; }
12float magnitude(Rope3D::Vec3 value) { return std::sqrt(value.x * value.x + value.y * value.y + value.z * value.z); }
21eve::Result<RopeTopologyChange> Rope3D::changeLength(float requested, float spacing, bool fromEnd) {
26 if (std::any_of(elements_.begin(), elements_.end(), [](const Element& element) { return !element.active; }))
41 eve::Diagnostic::error(eve::DiagnosticCode::PreconditionViolation, "Rope particle limit reached",
44 const auto heading = direction(particles_[particles_.size() - 2].position, particles_.back().position);
46 particle.position = particle.previous = addScaled(particles_.back().position, heading, segmentLength);
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
int getLastTornElement(int eventIndex) const
Returns a torn element index, or -1 for an invalid event index.
Definition Rope3DTopology.cpp:111
int getLastTornElementCount() const
Number of elements automatically torn by the most recent update/step.
Definition Rope3D.h:202
eve::Result< RopeTopologyChange > changeLength(float length, float particleSpacing, bool fromEnd=true)
Changes material length at one endpoint by adding/removing particles near the requested spacing.
Definition Rope3DTopology.cpp:21
@ Unchanged
@ InvalidArgument
@ PreconditionViolation
@ Conflict