//
// time: Tue Apr  8 11:47:35 1997
//
// version: 3.1.1 (format), 3.1.4 (DX Beta)
//
//
// Begin MDF
// MODULE ClipSurfaceMacro
// CATEGORY Macros
// DESCRIPTION clips a surface to a plane
// INPUT surface; field; (none);  surface to be clipped
// INPUT normal; value list or field or string or string list; (none); normal of plane to clip against
// OUTPUT output_1; field;  
// End MDF
//
// comment: Clips a surface against a plane (defined by a normal).
// workspace: width = 634, height = 603
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro ClipSurfaceMacro(
 surface
,normal
) -> (
 output_1
) {
    // 
    // node Input[12]: x = 0, y = 1, inputs = 0, label = Input
    // parameter: position = 1, name = 'surface', value = ' ', descriptive = 0, description = ' surface to be clipped', required = 1, visible = 1
    //
ClipSurfaceMacro_Input_12_out_1 = surface;
    // 
    // node Rename[4]: x = 0, y = 80, inputs = 3, label = Rename
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "data"
    // input[3]: defaulting = 0, visible = 1, type = 32, value = "saved data"
    //
ClipSurfaceMacro_Rename_4_out_1 = 
    Rename(
    ClipSurfaceMacro_Input_12_out_1,
    "data",
    "saved data"
    ) [instance: 4, cache: 1];
    // 
    // node Replace[3]: x = 17, y = 161, inputs = 4, label = Replace
    // input[3]: defaulting = 0, visible = 1, type = 32, value = "positions"
    //
ClipSurfaceMacro_Replace_3_out_1 = 
    Replace(
    ClipSurfaceMacro_Rename_4_out_1,
    ClipSurfaceMacro_Rename_4_out_1,
    "positions",
    NULL
    ) [instance: 3, cache: 1];
    // 
    // node Input[13]: x = 177, y = 182, inputs = 0, label = Input
    // parameter: position = 2, name = 'normal', value = ' ', descriptive = 0, description = 'normal of plane to clip against', required = 1, visible = 1
    //
ClipSurfaceMacro_Input_13_out_1 = normal;
    // 
    // node Compute[7]: x = 30, y = 241, inputs = 3, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0.0*$1.0 + $0.1*$1.1 + $0.2*$1.2 + $1.3"
    // expression: value = a.0*b.0 + a.1*b.1 + a.2*b.2 + b.3
    // name[2]: value = a
    // name[3]: value = b
    //
ClipSurfaceMacro_Compute_7_out_1 = 
    Compute(
    "$0.0*$1.0 + $0.1*$1.1 + $0.2*$1.2 + $1.3",
    ClipSurfaceMacro_Replace_3_out_1,
    ClipSurfaceMacro_Input_13_out_1
    ) [instance: 7, cache: 1];
    // 
    // node Refine[1]: x = 9, y = 315, inputs = 2, label = Refine
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "triangles"
    //
ClipSurfaceMacro_Refine_1_out_1 = 
    Refine(
    ClipSurfaceMacro_Compute_7_out_1,
    "triangles"
    ) [instance: 1, cache: 1];
    // 
    // node Band[4]: x = 116, y = 324, inputs = 4, label = Band
    // input[2]: defaulting = 0, visible = 1, type = 5, value = 0.0
    // input[4]: defaulting = 0, visible = 1, type = 32, value = "original"
    //
ClipSurfaceMacro_Band_4_out_1 = 
    Band(
    ClipSurfaceMacro_Refine_1_out_1,
    0.0,
    NULL,
    "original"
    ) [instance: 4, cache: 1];
    // 
    // node Include[5]: x = 21, y = 414, inputs = 6, label = Include
    // input[2]: defaulting = 1, visible = 1, type = 5, value = 0.0
    // input[3]: defaulting = 0, visible = 1, type = 5, value = 0.000001
    //
ClipSurfaceMacro_Include_5_out_1 = 
    Include(
    ClipSurfaceMacro_Band_4_out_1,
    NULL,
    0.000001,
    NULL,
    NULL,
    NULL
    ) [instance: 5, cache: 1];
    // 
    // node Rename[5]: x = 123, y = 509, inputs = 3, label = Rename
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "saved data"
    // input[3]: defaulting = 0, visible = 1, type = 32, value = "data"
    //
ClipSurfaceMacro_Rename_5_out_1 = 
    Rename(
    ClipSurfaceMacro_Include_5_out_1,
    "saved data",
    "data"
    ) [instance: 5, cache: 1];
    // 
    // node Output[3]: x = 239, y = 541, inputs = 1, label = Output
    // parameter: position = 1, name = 'output_1', value = ' ', descriptive = 0, description = ' ', required = 0, visible = 1
    //
output_1 = ClipSurfaceMacro_Rename_5_out_1;
    //
    // decorator Annotate	pos=(118,21) size=516x124 style(Label), value = <NULL>
    // annotation user_begin: 349
    // annotation user: Clip a surface against a plane.
    // annotation user: <NULL>
    // annotation user: Hide  the  data,  then   put  a  reference  to   the  positions  into   the  data
    // annotation user: component. Evaluate  the planar  equation  at  each  vertex. Use Band  to
    // annotation user: divide  the  surface  at  0.0,  and then  use Include to  remove  the portion
    // annotation user: of the surface behind the plane. Then restore the data component and we
    // annotation user: are done.
    // annotation user_end: <NULL>
// network: end of macro body
}
ClipSurfaceMacro_Input_12_out_1 = NULL;
ClipSurfaceMacro_Rename_4_out_1 = NULL;
ClipSurfaceMacro_Replace_3_out_1 = NULL;
ClipSurfaceMacro_Input_13_out_1 = NULL;
ClipSurfaceMacro_Compute_7_out_1 = NULL;
ClipSurfaceMacro_Refine_1_out_1 = NULL;
ClipSurfaceMacro_Band_4_out_1 = NULL;
ClipSurfaceMacro_Include_5_out_1 = NULL;
ClipSurfaceMacro_Rename_5_out_1 = NULL;
