Skip to content

impl Shape for Curve #37

@wahn

Description

@wahn

So far we support only four shapes:

$ rg -trust 'impl Shape' src
src/shapes/disk.rs
75:impl Shape for Disk {

src/shapes/sphere.rs
85:impl Shape for Sphere {

src/shapes/cylinder.rs
76:impl Shape for Cylinder {

src/shapes/triangle.rs
117:impl Shape for Triangle {

For hair we need curves:

Shape "curve" "string type" [ "cylinder" ] "point P" [ ... ] ...

So we have to implement all trait functions:

$ rg -trust 'trait Shape' src -A 15
src/core/shape.rs
8:pub trait Shape {
9-    fn object_bound(&self) -> Bounds3f;
10-    fn world_bound(&self) -> Bounds3f;
11-    fn intersect(&self, r: &Ray) -> Option<(SurfaceInteraction, Float)>;
12-    fn intersect_p(&self, r: &Ray) -> bool;
13-    fn get_reverse_orientation(&self) -> bool;
14-    fn get_transform_swaps_handedness(&self) -> bool;
15-    fn area(&self) -> Float;
16-    fn sample(&self, u: Point2f, pdf: &mut Float) -> InteractionCommon;
17-    fn sample_with_ref_point(&self,
18-                             iref: &InteractionCommon,
19-                             u: Point2f,
20-                             pdf: &mut Float)
21-                             -> InteractionCommon;
22-    fn pdf(&self, iref: &Interaction, wi: Vector3f) -> Float;
23-}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions