|
profile - profile handle x# - distance to the right, in metres y# - distance up, in metres corner (optional) - True keeps a sharp corner at this point in a smooth outline; False (default) |
|
Adds a point to a profile's outline. The points join in order to form the profile's free-form outline. CreateProfile's closed decides whether the last point joins back to the first, and smooth whether a curve or straight edges pass through them. AddProfileArc adds to the same outline, so straight runs and arcs can be mixed. In a smooth outline, corner True keeps a sharp point, such as the tip of a shield or the corners of a round-topped door. A straight-edged outline is already crisp wherever it turns by more than 40 degrees. What x and y mean depends on the command that uses the profile. For CreateLathe, x is the distance from the axis and must not be negative, and points on the axis close the shape. For CreateExtrusion with upward True, the outline is a plan seen from above and y runs along +Z. For CreateSweep, x and y are right and up as seen by a rider facing along the path. Each new edge builds the surface set by ProfileSurface. A profile handle that does not exist, or a coordinate or size that is not a finite number, stops the program with a runtime error. See also: CreateProfile, AddProfileArc, ProfileSurface, CreateExtrusion. |
; AddProfilePoint Example
; -----------------------
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,1,-5
light=CreateLight()
RotateEntity light,45,45,0
; A stand that rocks the shield gently from side to side
stand=CreatePivot()
PositionEntity stand,0,1,0
tip_steps=4
tip_corner=True
shield=0
While Not KeyDown(1)
; [ / ] move the tip, C makes it a sharp corner or a smooth curve
If KeyHit(26) And tip_steps>0 Then
tip_steps=tip_steps-1
If shield Then FreeEntity shield
shield=0
EndIf
If KeyHit(27) And tip_steps<8 Then
tip_steps=tip_steps+1
If shield Then FreeEntity shield
shield=0
EndIf
If KeyHit(46) Then
tip_corner=Not tip_corner
If shield Then FreeEntity shield
shield=0
EndIf
If shield=0 Then
; A smooth outline: the curve passes through every point
outline=CreateProfile(True,True)
; The top corners stay sharp
AddProfilePoint outline,-0.8,1,True
AddProfilePoint outline,0.8,1,True
AddProfilePoint outline,0.85,0.1
tip_y#=-0.6-tip_steps*0.1
AddProfilePoint outline,0,tip_y,tip_corner
AddProfilePoint outline,-0.85,0.1
shield=CreateExtrusion(outline,0.15,False,stand)
FreeProfile outline
EntityColor shield,60,110,220
EntityShininess shield,0.6
EndIf
RotateEntity stand,0,Sin(MilliSecs()*0.05)*40,0
; Arrow keys move the camera
If KeyDown(200) Then MoveEntity camera,0,0,0.1
If KeyDown(208) Then MoveEntity camera,0,0,-0.1
If KeyDown(203) Then TurnEntity camera,0,1,0
If KeyDown(205) Then TurnEntity camera,0,-1,0
RenderWorld
Text 0,0,"Arrow keys: move camera [ / ] : move the tip C: corner Esc: exit"
Text 0,20,"AddProfilePoint outline,0,"+tip_y+","+tip_corner
Text 0,40,"A corner point stays sharp inside a smooth outline"
Flip
Wend
End