Logo Search packages:      
Sourcecode: ktechlab version File versions

double Component::voltageLength ( double  v  )  [static, inherited]

Returns:
a value between 0.0 and 1.0, representing a scaled version of the absolute value of the voltage.
See also:
voltageColor

Definition at line 1107 of file component.cpp.

Referenced by Component::voltageColor().

{
    double v_max = 1e+1;
    double v_min = 1e-1;

    v = std::abs( v );

    if ( v >= v_max )
        return 1.0;
    else if ( v <= v_min )
        return 0.0;
    else
        return std::log( v / v_min ) / std::log( v_max / v_min );
}


Generated by  Doxygen 1.6.0   Back to index