# Defining a new solid A {class}`Solid` is defined as a {class}`Shape` and a {class}`Material` (and eventually a {class}`PTMaterial` for the path tracer). Its role is simply to wrap these data and pass them to the shader (with a proper ID). To simplify the creation of scenes, it can be useful to build various extension of the {class}`Solid` class, that will serve as shortcut to define a solid with a specific shape. ## Class extension Every solid should extend the class {class}`Solid`. Note that {class}`Solid` inherits from {class}`Generic`, which defines methods various method to assign a UUID, a name, a scene ID, to the solid. The constructor of {class}`Solid` takes the following arguments - **shape** ({class}`Shape`) : a shape - **material** ({class}`Material`) : a material (for basic rendering) - **ptMaterial** ({class}`PTMaterial`) *optional* : a material for path tracing ## Properties and methods The definition of a solid class does not require any particular property/method. All is already taken care of by the class {class}`Generic` from which it inherits. ## Example Below is the code used for euclidean balls. ```javascript import {Solid} from "../../../core/solids/Solid.js"; import {BallShape} from "../shapes/ball/BallShape.js"; /** * @class * * @classdesc * Euclidean ball */ export class Ball extends Solid { /** * @param {Isometry|Point} location - the location of the ball * @param {number} radius - the radius of the ball * @param {Material} material - the material of the ball * @param {PTMaterial} ptMaterial - material for path tracing (optional) */ constructor(location, radius, material, ptMaterial = undefined) { const shape = new BallShape(location, radius); super(shape, material, ptMaterial); } } ```