//Copyright (C) 2001 Locus Dialog //Author: Jean-Marc Valin #include "Node.h" #include "Matrix.h" #include "ObjectParser.h" #include #include using namespace std; namespace FD { class DCMatrix; DECLARE_NODE(DCMatrix) /*Node * * @name DCMatrix * @category Matrix * @description Creates a matrix of identical values * * @output_name OUTPUT * @output_type Matrix * @output_description The matrix * * @parameter_name ROWS * @parameter_type int * @parameter_description Number of rows * * @parameter_name COLUMNS * @parameter_type int * @parameter_description Number of columns * * @parameter_name VALUE * @parameter_type float * @parameter_description Value of each element * END*/ /** A constant node contains a value that will never changes. */ class DCMatrix : public Node { protected: /**The value of the constant*/ ObjectRef value; /**The ID of the 'value' output*/ int outputID; public: /**Constructor, takes the name of the node and a set of parameters*/ DCMatrix(string nodeName, ParameterSet params) : Node(nodeName, params) //, value (parameters.get("VALUE")) { outputID = addOutput("OUTPUT"); int rows = dereference_cast (parameters.get("ROWS")); int cols = dereference_cast (parameters.get("COLUMNS")); value = ObjectRef(new Matrix(rows, cols)); Matrix &val = object_cast > (value); float value = dereference_cast (parameters.get("VALUE"));; for (int i=0;i