载入中...
搜索中...
未找到
Rope3DTopology.cpp
浏览该文件的文档.
19Rope3D::Vec3 subtract(Rope3D::Vec3 a, Rope3D::Vec3 b) { return {a.x - b.x, a.y - b.y, a.z - b.z}; }
23float magnitude(Rope3D::Vec3 value) { return std::sqrt(value.x * value.x + value.y * value.y + value.z * value.z); }
32eve::Result<RopeTopologyChange> Rope3D::changeLength(float requested, float spacing, bool fromEnd) {
37 if (std::any_of(elements_.begin(), elements_.end(), [](const Element& element) { return !element.active; }))
52 eve::Diagnostic::error(eve::DiagnosticCode::PreconditionViolation, "Rope particle limit reached",
55 const auto heading = direction(particles_[particles_.size() - 2].position, particles_.back().position);
57 particle.position = particle.previous = addScaled(particles_.back().position, heading, segmentLength);
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
eve::Result< std::vector< std::uint32_t > > captureSegmentIndices() const
Copy currently active segment endpoints into an owning ordered index stream. @ownership Owns returned...
Definition Rope3DTopology.cpp:7
int getLastTornElement(int eventIndex) const
Returns a torn element index, or -1 for an invalid event index.
Definition Rope3DTopology.cpp:122
int getLastTornElementCount() const
Number of elements automatically torn by the most recent update/step.
Definition Rope3D.h:209
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:32
@ Unchanged
@ InvalidArgument
@ PreconditionViolation
@ Conflict