NetDEM v1.0
Loading...
Searching...
No Matches
solver_sphere_triangle.hpp
Go to the documentation of this file.
1#pragma once
2
5#include "contact_forces.hpp"
6#include "particle.hpp"
7#include "shape.hpp"
8#include "shape_sphere.hpp"
9#include "shape_triangle.hpp"
10#include "wall.hpp"
11
12namespace netdem {
13
21public:
26
33 SolverSphereTriangle(Particle *const p, Wall *const w);
34
40 CollisionSolverPW *Clone() const override;
41
49 void Init(Particle *const p, Wall *const w) override;
50
56 bool Detect() override;
57
65 void ResolveInit(ContactPW *const cnt, double timestep) override;
66
74 void ResolveUpdate(ContactPW *const cnt, double timestep) override;
75
83 void ResolveInit(CollisionGeometries *const cnt_geoms, double timestep);
84
92 void ResolveUpdate(CollisionGeometries *const cnt_geoms, double timestep);
93
94private:
96 double radius_1;
97
100 double dist_pc_to_tri;
101
103 Vec3d cnt_pos;
104
106 Vec3d cnt_dir_n;
107
109 double cnt_len_n;
110
112 double cnt_weight;
113
115 Triangle triangle;
116
120 void UpdateLocalTriangle();
121
125 void ResolvePotentialContact();
126
130 inline Vec3d GetLineCircleIntersection(double cr, Vec3d const &cc,
131 double dist_to_line,
132 Vec3d const &dir_n_cross_line,
133 Vec3d const &v0, Vec3d const &v1);
134
138 inline double GetTriangleArea(Vec3d const &v0, Vec3d const &v1,
139 Vec3d const &v2);
140
144 inline double GetCircleSegmentArea(double cr, double signed_d);
145};
146
147} // namespace netdem
A class representing the geometries associated with a collision.
Definition collision_geometries.hpp:15
An abstract class representing a collision solver for a particle and a wall.
Definition collision_solver_pw.hpp:20
A class representing a contact between a particle and a wall.
Definition contact_pw.hpp:22
Definition particle.hpp:26
A class used to solve collisions between a particle and a triangle.
Definition solver_sphere_triangle.hpp:20
void ResolveInit(ContactPW *const cnt, double timestep) override
Resolves the collision based on the initial contact information and timestep.
Definition solver_sphere_triangle.cpp:55
bool Detect() override
Detects if there is a collision between the particle and the wall.
Definition solver_sphere_triangle.cpp:30
void ResolveUpdate(ContactPW *const cnt, double timestep) override
Updates the contact information object and resolves the collision based on the updated information an...
Definition solver_sphere_triangle.cpp:63
CollisionSolverPW * Clone() const override
Clones the current SolverSphereTriangle instance.
Definition solver_sphere_triangle.cpp:14
SolverSphereTriangle()
Default constructor for SolverSphereTriangle class.
Definition solver_sphere_triangle.cpp:8
void Init(Particle *const p, Wall *const w) override
Initializes the SolverSphereTriangle instance with the given particles and walls.
Definition solver_sphere_triangle.cpp:18
A class representing a triangle in 3D space.
Definition shape_triangle.hpp:19
A class representing a wall object in a physics simulation.
Definition wall.hpp:32
Definition bond_entry.hpp:7
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18