User Tools

Site Tools


visual3d:documentation:pipeline:expressions:expression_numbers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:pipeline:expressions:expression_numbers [2024/06/19 12:49] sgrangervisual3d:documentation:pipeline:expressions:expression_numbers [2025/06/20 19:07] (current) – Added headers and cleaned up <code> tags. wikisysop
Line 1: Line 1:
-{{{{{{{{===== random =====+====== Expression Numbers ====== 
 + 
 +There is current a single "numbers"-related expression function. 
 + 
 +===== Random =====
  
 rand(lo_value,hi_value,signal) - random number in the range (lo_value,hi_value) rand(lo_value,hi_value,signal) - random number in the range (lo_value,hi_value)
  
-example rand() will generate a random number in the range 0 to 1 +==== ExampleGenerate a random number in the range 0 to 1 ==== 
-[[visual3d:documentation:pipeline:pipeline_commands:set_pipeline_parameter_from_expression|set_pipeline_parameter_from_expression]] + 
-/parameter_name=test1 +<code> 
-/expression=rand() +Set_Pipeline_Parameter_From_Expression 
-/as_integer=false +/PARAMETER_NAME=TEST1 
-**;** +/EXPRESSION=RAND() 
-::test1 = 0.220525 +/AS_INTEGER=FALSE 
-example rand(lo_value,hi_value) will generate a random number in the range lo_value to hi_value +
-[[visual3d:documentation:pipeline:pipeline_commands:set_pipeline_parameter_from_expression|set_pipeline_parameter_from_expression]] + 
-/parameter_name=test2 + TEST1 = 0.220525 
-/expression=rand(2,3) +</code> 
-/as_integer=false + 
-**;** +The default range for the random number is from 0 to 1. 
-::test2 = 2.232995 + 
-example : rand(lo_value,hi_value,signal) will generate a random number in the range lo_value to hi_value with the same number of components and frames as **signal**. +==== ExampleGenerate a random number within a range ====  
-[[visual3d:documentation:pipeline:pipeline_commands:set_pipeline_parameter_from_expression|set_pipeline_parameter_from_expression]] + 
-/parameter_name=test3 +<code> 
-/expression=rand(2,3,frame_numbers::original::frames+Set_Pipeline_Parameter_From_Expression 
-/as_integer=false +/PARAMETER_NAME=TEST2 
-**;** +/EXPRESSION=RAND(2,3) 
-::test3 = 2.808424+2.582592+2.346721+2.697052+2.662510+2.861250+2.843808+...(to number of frames) +/AS_INTEGER=FALSE 
-example : rand(lo_value,hi_value,signal)if signal is number, that number of values are returned. +
-[[visual3d:documentation:pipeline:pipeline_commands:set_pipeline_parameter_from_expression|set_pipeline_parameter_from_expression]] + 
-/parameter_name=test4 + TEST2 = 2.232995 
-/expression=rand(2,3,3) +</code> 
-/as_integer=false + 
-**;** +The output value occurs in the range from lo_value to hi_value
-::test4 = 2.446495 + 2.718410 + 2.201863 + 
-example create target with random values between 0 and 1 +==== Example: Generate a random number in range to match a signal ====  
-[[visual3d:documentation:pipeline:signal_commands:create_target|create_target]] + 
-/signal_names=test5 +<code> 
-! /signal_description+Set_Pipeline_Parameter_From_Expression 
-/expression=rand(0,1,target::original::lft1+/PARAMETER_NAME=TEST3 
-! /include_calfile=false +/EXPRESSION=RAND(2,3,FRAME_NUMBERS::ORIGINAL::FRAMES
-**;** +/AS_INTEGER=FALSE 
-view the resulting signal in the 3d viewer by turning on the target trail +; 
-random_target.jpg + 
-example: create a target with random values between 0 and 1. +::TEST3 = 2.808424+2.582592+2.346721+2.697052+2.662510+2.861250+2.843808+...(to number of frames) 
-[[visual3d:documentation:pipeline:signal_commands:create_target|create_target]] +</code> 
-/signal_names=test6 + 
-! /signal_description+Using all three arguments will produce a random number in the range from lo_value to hi_value with the same number of components and frames as the argument signal. 
-/expression=vector(rand(0,1,frame_numbers::original::frames),rand(0,1,frame_numbers::original::frames),rand(0,1,frame_numbers::original::frames)) + 
-! /include_calfile=false +==== Example: Generate specific number of random values ====  
-**;** + 
-note that all components contain different values+<code> 
 +Set_Pipeline_Parameter_From_Expression 
 +/PARAMETER_NAME=TEST4 
 +/EXPRESSION=RAND(2,3,3) 
 +/AS_INTEGER=FALSE 
 +; 
 + 
 +::TEST4 = 2.446495 + 2.718410 + 2.201863 
 +</code> 
 + 
 +If the signal argument is a number, then that number of random values from the range lo_value to hi_value are returned. 
 + 
 +==== ExampleCreate TARGET with random values between 0 and 1 ==== 
 + 
 +<code> 
 +Create_Target 
 +/SIGNAL_NAMES=TEST5 
 +! /SIGNAL_DESCRIPTION
 +/EXPRESSION=RAND(0,1,TARGET::ORIGINAL::LFT1
 +! /INCLUDE_CALFILE=FALSE 
 +
 + 
 +</code> 
 + 
 +View the resulting signal in the 3D viewer by turning on the target trail: 
 + 
 +{{:random_target.jpg}} 
 + 
 +==== Example: create a TARGET with random values between 0 and 1 ==== 
 + 
 +<code> 
 +Create_Target 
 +/SIGNAL_NAMES=TEST6 
 +! /SIGNAL_DESCRIPTION
 +/EXPRESSION=VECTOR(RAND(0,1,FRAME_NUMBERS::ORIGINAL::FRAMES),RAND(0,1,FRAME_NUMBERS::ORIGINAL::FRAMES),RAND(0,1,FRAME_NUMBERS::ORIGINAL::FRAMES)) 
 +! /INCLUDE_CALFILE=FALSE 
 +
 +</code> 
 + 
 +Note that all components contain different values 
 + 
 +{{:Random7.jpg}} {{:random7view.jpg}} 
 + 
 +==== Example: Create a TARGET where each frame is on a random location on the surface of a sphere of radius 1 ==== 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION=RAND(-PI(),PI(),FRAME_NUMBERS::ORIGINAL::FRAMES) 
 +/RESULT_TYPES=DERIVED 
 +/RESULT_FOLDERS=RADIUS 
 +/RESULT_NAME=VERTICAL 
 +! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE 
 +
 + 
 +Evaluate_Expression 
 +/EXPRESSION=RAND(0,2*PI(),FRAME_NUMBERS::ORIGINAL::FRAMES) 
 +/RESULT_TYPES=DERIVED 
 +/RESULT_FOLDERS=RADIUS 
 +/RESULT_NAME=HORIZONTAL 
 +! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE 
 +
 + 
 +Create_Target 
 +/SIGNAL_NAMES=SPHERE 
 +! /SIGNAL_DESCRIPTION= 
 +/EXPRESSION=VECTOR( 
 +COS(DERIVED::RADIUS::VERTICAL)*COS(DERIVED::RADIUS::HORIZONTAL), 
 +-COS(DERIVED::RADIUS::VERTICAL)*SIN(DERIVED::RADIUS::HORIZONTAL), 
 +SIN(DERIVED::RADIUS::VERTICAL)) 
 +! /INCLUDE_CALFILE=FALSE 
 +
 +</code>
  
-random7.jpgrandom7view.jpg +{{:random8view.jpg}}
-example : create a target where each frame is on a random location on the surface of a sphere of radius 1 +
-**evaluate_expression** +
-/expression=rand(-pi(),pi(),frame_numbers::original::frames) +
-/result_types=derived +
-/result_folders=radius +
-/result_name=vertical +
-! /apply_as_suffix_to_signal_name=false +
-**;** +
-**evaluate_expression** +
-/expression=rand(0,2*pi(),frame_numbers::original::frames) +
-/result_types=derived +
-/result_folders=radius +
-/result_name=horizontal +
-! /apply_as_suffix_to_signal_name=false +
-**;** +
-[[visual3d:documentation:pipeline:signal_commands:create_target|create_target]] +
-/signal_names=sphere +
-! /signal_description= +
-/expression=vector( +
-cos(derived::radius::vertical)*cos(derived::radius::horizontal), +
--cos(derived::radius::vertical)*sin(derived::radius::horizontal), +
-sin(derived::radius::vertical)) +
-! /include_calfile=false +
-**;** +
-random8view.jpg+
  
-}}}}}}}} 
visual3d/documentation/pipeline/expressions/expression_numbers.1718801395.txt.gz · Last modified: 2024/06/19 12:49 by sgranger