feat: add direction particle advection
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -386,6 +386,31 @@ TEST(Source, ParticleFieldV3CompatibilityAndContentIdentityAreChannelAware) {
|
||||
EXPECT_FALSE(particle::sameFieldGpuContent(vector, vectorChanged));
|
||||
}
|
||||
|
||||
TEST(Source, ParticleFieldV3DirectionAdvectionResolution) {
|
||||
std::array<float, 2> resolved{};
|
||||
|
||||
EXPECT_TRUE(particle::resolveParticleAdvection(particle::VectorSemantics::Direction,
|
||||
{{1.0f, 0.0f}}, {{1.0f, 0.0f}}, 0.0f, 2.0f, resolved));
|
||||
EXPECT_FLOAT_EQ(2.0f, resolved[0]);
|
||||
EXPECT_FLOAT_EQ(0.0f, resolved[1]);
|
||||
EXPECT_TRUE(particle::resolveParticleAdvection(particle::VectorSemantics::Direction,
|
||||
{{0.0f, 1.0f}}, {{0.0f, 1.0f}}, 0.0f, 2.0f, resolved));
|
||||
EXPECT_FLOAT_EQ(0.0f, resolved[0]);
|
||||
EXPECT_FLOAT_EQ(2.0f, resolved[1]);
|
||||
|
||||
EXPECT_TRUE(particle::resolveParticleAdvection(particle::VectorSemantics::Direction,
|
||||
{{1.0f, 0.0f}}, {{0.0f, 1.0f}}, 0.5f, 3.0f, resolved));
|
||||
EXPECT_NEAR(3.0f / std::sqrt(2.0f), resolved[0], 0.00001f);
|
||||
EXPECT_NEAR(3.0f / std::sqrt(2.0f), resolved[1], 0.00001f);
|
||||
EXPECT_FALSE(particle::resolveParticleAdvection(particle::VectorSemantics::Direction,
|
||||
{{1.0f, 0.0f}}, {{-1.0f, 0.0f}}, 0.5f, 1.0f, resolved));
|
||||
|
||||
EXPECT_TRUE(particle::resolveParticleAdvection(particle::VectorSemantics::Velocity,
|
||||
{{2.0f, -3.0f}}, {{6.0f, 1.0f}}, 0.25f, 999.0f, resolved));
|
||||
EXPECT_FLOAT_EQ(3.0f, resolved[0]);
|
||||
EXPECT_FLOAT_EQ(-2.0f, resolved[1]);
|
||||
}
|
||||
|
||||
TEST(Source, LocalProductionFeedSubmitsSnapshotsWithProducerTime) {
|
||||
const auto field = fixtureBytes("uniform-east", "field.f32");
|
||||
const std::vector<char> payload(field.begin(), field.end());
|
||||
|
||||
Reference in New Issue
Block a user