sdfModifiers Module

This module defines transforms that can be applied to each SDF: - Union - Intersection - Subtraction - Displacement - Bend - Twist - Elongate - Repeat - Extrude - Revolution - Onion



Interfaces

public interface bend

  • private function bend_init(prim, k) result(out)

    Initialise the Bend modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    real(kind=wp), intent(in) :: k

    Amoun to bend by.

    Return Value type(bend)

public interface displacement

  • private function displacement_init(prim, func) result(out)

    Initialise the displacement modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    procedure(primitive) :: func

    Function to displace the SDF with.

    Return Value type(displacement)

public interface elongate

  • private function elongate_init(prim, size) result(out)

    Initialise the elongate modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    type(vector), intent(in) :: size

    Distance to elongate by

    Return Value type(elongate)

public interface extrude

  • private function extrude_init(prim, h) result(out)

    Initialise the extrude modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    real(kind=wp), intent(in) :: h

    Distance to extrude by.

    Return Value type(extrude)

public interface onion

  • private function onion_init(prim, thickness) result(out)

    Initialise the Onion modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    real(kind=wp), intent(in) :: thickness

    Thickned to onion by.

    Return Value type(onion)

public interface repeat

  • private function repeat_init(prim, c, la, lb) result(out)

    Initialise the Repeat modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    real(kind=wp), intent(in) :: c
    type(vector), intent(in) :: la
    type(vector), intent(in) :: lb

    Return Value type(repeat)

public interface revolution

  • private function revolution_init(prim, o) result(out)

    Initialise the Revolution modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    real(kind=wp), intent(in) :: o

    Amount to revolve by.

    Return Value type(revolution)

public interface twist

  • private function twist_init(prim, k) result(out)

    Initialise the twist modifier for a SDF.

    Arguments

    Type IntentOptional Attributes Name
    class(sdf_base), target :: prim

    SDF to modify

    real, intent(in) :: k

    Twist parameter.

    Return Value type(twist)


Derived Types

type, public, extends(sdf_base) ::  bend

Bend a SDF.

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: k
integer, public :: layer

Layer ID of SDF

type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function bend_init (prim, k)

Initialise the Bend modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_bend

type, public, extends(sdf_base) ::  displacement

Displace the surface of a SDF by a function.

Components

Type Visibility Attributes Name Initial
procedure(primitive), public, nopass, pointer :: func
integer, public :: layer

Layer ID of SDF

type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function displacement_init (prim, func)

Initialise the displacement modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_disp

type, public, extends(sdf_base) ::  elongate

Elongate a SDF

Components

Type Visibility Attributes Name Initial
integer, public :: layer

Layer ID of SDF

type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
type(vector), public :: size
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function elongate_init (prim, size)

Initialise the elongate modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_elongate

type, public, extends(sdf_base) ::  extrude

Extrude a 2D SDF into 3D

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: h
integer, public :: layer

Layer ID of SDF

type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function extrude_init (prim, h)

Initialise the extrude modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_extrude

type, public, extends(sdf_base) ::  onion

Carves or gives thickness to SDFs

Components

Type Visibility Attributes Name Initial
integer, public :: layer

Layer ID of SDF

type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: thickness
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function onion_init (prim, thickness)

Initialise the Onion modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_onion

type, public, extends(sdf_base) ::  repeat

Repeat a SDF

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: c
type(vector), public :: la
integer, public :: layer

Layer ID of SDF

type(vector), public :: lb
type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function repeat_init (prim, c, la, lb)

Initialise the Repeat modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_repeat

type, public, extends(sdf_base) ::  revolution

Revoloution modifier. Revolves an SDF around the z axis (need to check this!!)

Components

Type Visibility Attributes Name Initial
integer, public :: layer

Layer ID of SDF

real(kind=wp), public :: o
type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function revolution_init (prim, o)

Initialise the Revolution modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_revolution

type, public, extends(sdf_base) ::  twist

Twist a SDF

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: k
integer, public :: layer

Layer ID of SDF

type(opticalProp_t), public :: optProps

Optical property of the SDF

class(sdf_base), public, pointer :: prim
real(kind=wp), public :: transform(4,4)

Transform to apply to SDF.

Constructor

private function twist_init (prim, k)

Initialise the twist modifier for a SDF.

Type-Bound Procedures

procedure, public :: evaluate => eval_twist

Functions

public pure function SmoothUnion(d1, d2, k) result(res)

Smooth union. Joins two SDFs together smoothly

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: d1

SDF_1 distance

real(kind=wp), intent(in) :: d2

SDF_2 distance

real(kind=wp), intent(in) :: k

smoothing factor.

Return Value real(kind=wp)

private function bend_init(prim, k) result(out)

Initialise the Bend modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

real(kind=wp), intent(in) :: k

Amoun to bend by.

Return Value type(bend)

private function displacement_init(prim, func) result(out)

Initialise the displacement modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

procedure(primitive) :: func

Function to displace the SDF with.

Return Value type(displacement)

private function elongate_init(prim, size) result(out)

Initialise the elongate modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

type(vector), intent(in) :: size

Distance to elongate by

Return Value type(elongate)

private pure elemental function eval_bend(this, pos) result(res)

Evaluation function for Bend modifier.

Arguments

Type IntentOptional Attributes Name
class(bend), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_disp(this, pos) result(res)

Evaluation function for displacement modifier.

Arguments

Type IntentOptional Attributes Name
class(displacement), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_elongate(this, pos) result(res)

Evaluation function for Elongate modifier.

Arguments

Type IntentOptional Attributes Name
class(elongate), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_extrude(this, pos) result(res)

Evaluation function for Extrude modifier.

Arguments

Type IntentOptional Attributes Name
class(extrude), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_onion(this, pos) result(res)

Evaluation function for Onion modifier.

Arguments

Type IntentOptional Attributes Name
class(onion), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_repeat(this, pos) result(res)

Evaluation function for Repeat modifier.

Arguments

Type IntentOptional Attributes Name
class(repeat), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_revolution(this, pos) result(res)

Evaluation function for Revolution modifier.

Arguments

Type IntentOptional Attributes Name
class(revolution), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private pure elemental function eval_twist(this, pos) result(res)

Evaluation function for Twist modifier.

Arguments

Type IntentOptional Attributes Name
class(twist), intent(in) :: this
type(vector), intent(in) :: pos

Position to evaluate the modifier at

Return Value real(kind=wp)

private function extrude_init(prim, h) result(out)

Initialise the extrude modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

real(kind=wp), intent(in) :: h

Distance to extrude by.

Return Value type(extrude)

public pure function intersection(d1, d2, k) result(res)

Intersection operator. Returns the intersection of two SDFs.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: d1

SDF_1 distance

real(kind=wp), intent(in) :: d2

SDF_2 distance

real(kind=wp), intent(in) :: k

smoothing factor.

Return Value real(kind=wp)

private function onion_init(prim, thickness) result(out)

Initialise the Onion modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

real(kind=wp), intent(in) :: thickness

Thickned to onion by.

Return Value type(onion)

private function repeat_init(prim, c, la, lb) result(out)

Initialise the Repeat modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

real(kind=wp), intent(in) :: c
type(vector), intent(in) :: la
type(vector), intent(in) :: lb

Return Value type(repeat)

private function revolution_init(prim, o) result(out)

Initialise the Revolution modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

real(kind=wp), intent(in) :: o

Amount to revolve by.

Return Value type(revolution)

public pure function subtraction(d1, d2, k) result(res)

Subtraction operator. Takes one SDF from another. Take the first SDF from the 2nd SDF

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: d1

SDF_1 distance

real(kind=wp), intent(in) :: d2

SDF_2 distance

real(kind=wp), intent(in) :: k

unused factor.

Return Value real(kind=wp)

private function twist_init(prim, k) result(out)

Initialise the twist modifier for a SDF.

Arguments

Type IntentOptional Attributes Name
class(sdf_base), target :: prim

SDF to modify

real, intent(in) :: k

Twist parameter.

Return Value type(twist)

public pure function union(d1, d2, k) result(res)

Union operation. Joins two SDFs together

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: d1

SDF_1 distance

real(kind=wp), intent(in) :: d2

SDF_2 distance

real(kind=wp), intent(in) :: k

unused factor

Return Value real(kind=wp)