SetShapeVertex
SetShapeVertex ShapeIndex, VertexIndex, Xpos, Ypos
 
Parameters:

    ShapeIndex = The Index of the shape you wish to create
    VertexIndex = The index of the vertex you wish to set
    Xpos = The X position of this vertex
    Ypos = The Y position of this vertex
Returns: NONE
 

      SetShapeVertex set the position of vertex within this shape.

      To construct a shape, we need two things. First we define a set of points (called vertex) using . These points are the corners of our shape. Next we join these points together to form the edges (or boarders) of the shape. These edges are assumed to create an enclosed space. But they don't have to, one of the beauties about shapes, is that you can pretty much join any points together and DrawShape command will try and render it.




FACTS:


      * Shape Vertex are considered to be offsets from a shapes axis.




Mini Tutorial:


      This example creates a shape, defines two squares of vertex and then connects the outer and inner vertex together to form a hollowed out box of sorts.

  
; Create MySHape, with room for 10 vertex and
; 10 edge connections
  MyShape=NewShape(10,10)
  
; Set the 5 vertex positions in this shape
; Set vertex #1, -50x,-50y
  SetShapeVertex MySHape,1,-50,-50
  SetShapeVertex MySHape,2,50,-50
  SetShapeVertex MySHape,3,50,50
  SetShapeVertex MySHape,4,-50,50
  
  SetShapeVertex MySHape,5,-20,-20
  SetShapeVertex MySHape,6,20,-20
  SetShapeVertex MySHape,7,20,20
  SetShapeVertex MySHape,8,-20,20
  
  
; Connect the vertex together to form the edges
; Connect outter edges
  SetShapeEdge MyShape,1,1,2
  SetShapeEdge MyShape,2,2,3
  SetShapeEdge MyShape,3,3,4
  SetShapeEdge MyShape,4,4,1
; connect inner edges
  SetShapeEdge MyShape,5,5,6
  SetShapeEdge MyShape,6,6,7
  SetShapeEdge MyShape,7,7,8
  SetShapeEdge MyShape,8,8,5
  
  
; Draw the shapes points
  CenterText 100,20,"Shape Vertex"
  DrawShape MyShape,100,100,0
  
; Draw the outline (edges) of this shape
  CenterText 250,20,"Shape Edges"
  DrawShape MyShape,250,100,1
  
; Draw the Filled shape
  CenterText 400,20,"Filled Shape"
  DrawShape MyShape,400,100,2
  
  Sync
  WaitKey
  



      This example outputs.






 
Related Info: CreateShape | GetFreeShape | GetShapeVertexX | GetShapeVertexY | GetShapeVerts | NewShape | SetShapeEdge :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com