Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps

Library of functions returning color maps

Information


This package contains functions that return color maps. A color map is a Real[:,3] array where every row represents a color. Currently the following color maps are returned from the respective function:

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

NameDescription
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.jet jet Returns the "jet" color map
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.hot hot Returns the "hot" color map
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.gray gray Returns the "gray" color map
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.spring spring Returns the "spring" color map
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.summer summer Returns the "summer" color map
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.autumn autumn Returns the "autumn" color map
Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.winter winter Returns the "winter" color map


Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.jet

Returns the "jet" color map

Information


Syntax

ColorMaps.jet();
ColorMaps.jet(n_colors=64);

Description

This function returns the color map "jet." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "jet" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function jet "Returns the \"jet\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
protected 
   Real a=ceil(n_colors/4);
   Real d=1/a;
   Real v1[:]=if d >= 0.5 then {1} else if d >= 0.25 then  1-d:d:1 else 0.5+d:d:1;
   Real v2[:]=0+d:d:1;
   Real v3[:]=1-d:-d:0;
   Real v4[:]=1-d:-d:0.5;
   Real cm[integer(a)*4,3];
algorithm 
   cm:=255*[zeros(size(v1,1)),zeros(size(v1,1)),  v1;
            zeros(size(v2,1)), v2,  fill(1., size(v2,1));
            v2,              fill(1, size(v2,1)), v3;
            fill(1, size(v3,1)),v3, fill(0.,size(v3,1));
            v4, fill(0,size(v4,1)),fill(0.,size(v4,1))];
   colorMap:=cm[1:n_colors,:];

end jet;

Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.hot

Returns the "hot" color map

Information


Syntax

ColorMaps.hot();
ColorMaps.hot(n_colors=64);

Description

This function returns the color map "hot." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "hot" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function hot "Returns the \"hot\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
protected 
   Real a=ceil(n_colors/3);
   Real d=1/a;
   Real v1[:]=0+d:d:1;
   Real cm[integer(a)*3,3];
algorithm 
 cm := 255*[v1, zeros(size(v1, 1)),zeros(size(v1, 1));
                          fill(1., size(v1, 1)), v1,zeros(size(v1, 1));
                          fill(1., size(v1, 1)),fill(1., size(v1, 1)),v1];
 colorMap:=cm[1:n_colors,:];

end hot;

Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.gray

Returns the "gray" color map

Information


Syntax

ColorMaps.gray();
ColorMaps.gray(n_colors=64);

Description

This function returns the color map "gray." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "gray" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function gray "Returns the \"gray\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
algorithm 
  if n_colors > 1 then
    colorMap := 255*[linspace(0,1.,n_colors),linspace(0,1.,n_colors),linspace(0,1.,n_colors)];
  else
    colorMap:=[0,0,0];
   end if;

end gray;

Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.spring

Returns the "spring" color map

Information


Syntax

ColorMaps.spring();
ColorMaps.spring(n_colors=64);

Description

This function returns the color map "spring." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "spring" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function spring "Returns the \"spring\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
algorithm 
  if n_colors > 1 then
     colorMap := 255*[fill(1,n_colors),linspace(0,1.,n_colors),linspace(1,0,n_colors)];
   else
    colorMap:=255*[1,0,1];
   end if;

end spring;

Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.summer

Returns the "summer" color map

Information


Syntax

ColorMaps.summer();
ColorMaps.summer(n_colors=64);

Description

This function returns the color map "summer." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "summer" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function summer "Returns the \"summer\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
algorithm 
  if n_colors > 1 then
     colorMap := 255*[linspace(0,1.,n_colors),linspace(0.5,1.,n_colors),fill(0.4,n_colors)];
   else
    colorMap:=255*[0,0.5,0.4];
   end if;

end summer;

Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.autumn

Returns the "autumn" color map

Information


Syntax

ColorMaps.autumn();
ColorMaps.autumn(n_colors=64);

Description

This function returns the color map "autumn." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "autumn" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function autumn "Returns the \"autumn\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
algorithm 
  if n_colors > 1 then
     colorMap := 255*[fill(1,n_colors),linspace(0,1.,n_colors),zeros(n_colors)];
   else
    colorMap:=255*[1,0,0];
   end if;

end autumn;

Modelica.Mechanics.MultiBody.Visualizers.Colors.ColorMaps.winter

Returns the "winter" color map

Information


Syntax

ColorMaps.winter();
ColorMaps.winter(n_colors=64);

Description

This function returns the color map "winter." A color map is a Real[:,3] array where every row represents a color. With the optional argument "n_colors" the number of rows of the returned array can be defined. The default value is "n_colors=64" (it is usually best if n_colors is a multiple of 4). Image of the "winter" color map:

See also

ColorMaps, colorMapToSvg, scalarToColor.

Extends from Modelica.Mechanics.MultiBody.Interfaces.partialColorMap (Interface for a function returning a color map).

Inputs

TypeNameDefaultDescription
Integern_colors64Number of colors in the color map

Outputs

TypeNameDescription
RealcolorMap[n_colors, 3]Color map to map a scalar to a color

Modelica definition

function winter "Returns the \"winter\" color map"
extends Modelica.Mechanics.MultiBody.Interfaces.partialColorMap;
algorithm 
  if n_colors > 1 then
     colorMap := 255*[zeros(n_colors),linspace(0,1,n_colors),linspace(1,0.5,n_colors)];
   else
    colorMap:=[0,0,255];
   end if;

end winter;

Automatically generated Fri Nov 12 16:30:40 2010.