> For the complete documentation index, see [llms.txt](https://tlcfem.gitbook.io/suanpan-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tlcfem.gitbook.io/suanpan-manual/constraint/particlecollision.md).

# ParticleCollision

The `ParticleCollision2D` and `ParticleCollision3D` constraints can be used to simulate collision of particles of uniform size.

## Syntax

```
ParticleCollision2D (1) (2) (3)
ParticleCollision3D (1) (2) (3)
constraint ParticleCollision2D (1) (2) (3)
constraint ParticleCollision3D (1) (2) (3)
# (1) int, unique constraint tag
# (2) double, space
# (3) double, penalty number
```

The constraint is applied to ALL particles defined in the system. Since any two particles can collide with each other, there is no way to obtain the structural topology. Thus, the full/sparse matrix storage shall be used. Parameter `(2)` controls the uniform size of particles. When any two particles are closer than the value defined in `(2)`, interaction forces will be applied. The penalty method is used in implementation, thus parameter `(3)` represents the penalty number, adjusting this value leads to different magnitudes of interaction forces.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tlcfem.gitbook.io/suanpan-manual/constraint/particlecollision.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
