Currently, there is ExternalDistanceInteraction class and it receives Shape class such as AxisAlignedPlane. By doing this, we can encapsulate the detail of shapes. It means that to add a spherical cap, we need only a "Sphere" class that has a member function to calculate normal vector.
But it turned out that the scope of this class is a bit limited. For example, a normal vector of Box is always perpendicular to one of the planes of which the box is composed. But the force applied to a particle is not always parallel to the normal because a particle may interact with several planes.
Still, we can use ExternalDistanceInteraction, but I decided that I will gradually replace it with more concrete types such as PlanarSurfaceInteraction. It requires more effort and lines of codes, but sometimes (not always, of course) longer and specific code can be more helpful than abstraction.
Currently, there is
ExternalDistanceInteractionclass and it receivesShapeclass such asAxisAlignedPlane. By doing this, we can encapsulate the detail of shapes. It means that to add a spherical cap, we need only a "Sphere" class that has a member function to calculate normal vector.But it turned out that the scope of this class is a bit limited. For example, a normal vector of
Boxis always perpendicular to one of the planes of which the box is composed. But the force applied to a particle is not always parallel to the normal because a particle may interact with several planes.Still, we can use
ExternalDistanceInteraction, but I decided that I will gradually replace it with more concrete types such asPlanarSurfaceInteraction. It requires more effort and lines of codes, but sometimes (not always, of course) longer and specific code can be more helpful than abstraction.