STATE_layer_set_shape

 

 


  This function provides an easy way for changing the shape of a layer.
  This function is good for creating any shape that is build from 3 or 4 points for eample:
  	any 2D line
  	any kind of triangle
  	any kind of rectangle or any other 4 point shapes.
   For more complex modify the points using STATE_point_set_xyz() and STATE_polygon_add_point()
  
   Parameters:
  
  		layer_handle:
  			This is the handle that is returned from STATE_layer_create()
  			Even if you are not interested in the rectangle layer shape offered by
  			STATE_layer_create(), you should call for creating the layer
  			and then call this function to set the desired shape.
  
  		start, end
  			The function actually creates a line from start to end though by controling the width
  			of the two ends of the line one can create any 4 or 3 points shape.
  
  		base_width, end_width:
  			The width of the created line in each one of its edges
  
  
   Remarks:
  		Note that if the base_width of the end_width is 0, the function would create a triangle
  		and will delete one of the layer points. This means that handles to this layer points
  		should be set to NULL after calling this function.
  
   Example A:
  		  creating a diagnal line. from one side of the screen to the other
  		  First we will create the layer. Note that the initial shape doesn't matter (the 0,0,100,100 below)
  		  since we will overide it later when we call STATE_layer_set_shape()
  		DWORD my_layer=STATE_layer_create(0,0,100,100, NULL, DISABLE_BLENDING);
  		double start[3]={0,0,1};
  		double end[3]={100,100,1};
  		STATE_layer_set_shape(my_layer, start, end, 0.5, 0.5);
  
   Example B:
  		  Creating a triangle (we will assume that my_layer was already created)
  		double start[3]={0,50,1};
  		double end[3]={100,50,1};
  		STATE_layer_set_shape(my_layer, start, end, 50, 0);
  
   Example C:
  		  Creating a non horizontal square (we will assume that my_layer was already created)
  		double start[3]={25,25,1};
  		double end[3]={75,75,1};
  		STATE_layer_set_shape(my_layer, start, end, 50, 50);
  

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com