+++
title = "HorizontalCylinder"
+++

### HorizontalCylinder

A horizontal truncated circular cylinder along x-axis

<img src="/img/draw/ff/3d/HorizontalCylinder.png" width="30%" >
<img src="/img/draw/ff/2d/HorizontalCylinder_xz.svg" width="30%">
<img src="/img/draw/ff/2d/HorizontalCylinder_yz.svg" width="30%">

#### Constructor

Full form
```python
HorizontalCylinder(R, H, t, b) 
```
and short form 
```python
HorizontalCylinder(R, H) == HorizontalCylinder(R, H, 0, 0) 
```

Parameters:
- $ R $, radius
- $ H $, height
- $ t $, cut from top
- $ b $, cut from bottom

Constraint:

$ 2R - t - b \ge 0 $ 

#### Usage

As for any other [Form factor](/ref/sample/particle/ff).

#### Implementation

Class {{% ref-class "Sample/HardParticle" "HorizontalCylinder" %}} inherits from the interface class
{{% ref-class "Sample/Particle" "Formfactor" %}}.

Form factor is computed as

$$ F(\mathbf{q})=2 L \space \text{sinc}\Big(q_x\dfrac{L}{2}\Big) \exp\[iq_z(R-b)\]
\int_{-R+b}^{R-t} \text{d}z \space \sqrt{R^2-z^2} \space \text{sinc}(q_y\sqrt{R^2-z^2})  \exp\[iq_z z\] , $$

Volume [has been validated]({{% url-src %}}/Tests/Unit/Sample/FormfactorBasicTest.cpp)
against
$$V=L \Big\( (R-t)\sqrt{2Rt-t^2}- (R-b)\sqrt{2Rb-b^2} + R^2 \Big\[\text{asin}\Big(1-\frac{t}{R}\Big) + \text{asin}\Big(1-\frac{b}{R}\Big) \Big\]
 \Big\).$$

#### Related shapes

More general:
- [Cylinder](/ref/sample/particle/ff/hard/cylinder), if vertical and non-truncated.
 
#### Example

Scattering by uncorrelated, oriented horizontal truncated cylinders for horizontal incidence. Rotation around $z$ axis:

<img src="/img/auto/ff/HorizontalCylinder.png">

Generated by {{% ref-ex "sas/sas-ff.py" %}} (`particle_geometry=HorizontalCylinder`).

#### History

Introduced in BornAgain 1.20.

API has changed in v24.
