Do you know how to calcul the "tangent" point in that kind of figure ?
When I draw, I get the Black curve, with the points in orange (A, C, E). I konw the position X/Y of this points.
What I would like is to change those points and get the position of : B, C, D . (C has the same position as previously of course, only and E have to change°
A should take the position of B
E should get the position of D
To get the curve in grey.
My drawing is made with the lib vector drawing.
I can post a code if needed.
Do you know how I can calculate that ?
Thank you a lot.
EDIT :
Code: Select all
; Made with Cartoon ! 0.30
; Date : 2021/07/26, 14:10:41
Global Zoom.f =2
Structure sPoint
x.d
y.d
EndStructure
Global Dim node.spoint(6)
line$ ="103,295,102,197,103,180,173,120,252,170,253,196,256,295"
For i=0 To 6
Node(i)\x = Val(StringField(line$,i*2+1,","))
Node(i)\Y = Val(StringField(line$,i*2+2,","))
Next
Procedure Object0(x,y)
Protected Z.f
Z = Zoom
; draw the curve
MovePathCursor((node(0)\x+x)*Z, (node(0)\y+y)*Z)
For i=1 To ArraySize(node())-2 Step 3
AddPathCurve( (node(i)\x+x)*z, (node(i)\y+y)*z, (node(i+1)\x+x)*z, (node(i+1)\y+y)*z, (node(i+2)\x+x)*z, (node(i+2)\y+y)*z)
Next
VectorSourceColor(RGBA(0,0,0,255))
StrokePath(3,#PB_Path_RoundEnd)
; the circle to see the point
For i= 0 To ArraySize(node())-1
If Mod(i,3)=0 Or Mod(i,3) = 2
x1.d = (node(i+1)\x+x)*z
y1.d = (node(i+1)\y+y)*z
MovePathCursor((node(i)\x+x)*Z, (node(i)\y+y)*Z)
AddPathLine(x1,y1)
VectorSourceColor(RGBA(0,0,0,100))
DashPath(2,5)
EndIf
Next
MovePathCursor((node(0)\x+x)*Z, (node(0)\y+y)*Z)
For i= 0 To ArraySize(node())
x1.d = (node(i)\x+x)*z
y1.d = (node(i)\y+y)*z
AddPathCircle(x1,y1,10)
VectorSourceColor(RGBA(255,0,0,100))
StrokePath(2)
If Mod(i,3)=0
AddPathCircle(x1,y1,7)
VectorSourceColor(RGBA(0,255,255,100))
FillPath()
EndIf
Next
EndProcedure
; code test
w = 1024
h = 600
OpenWindow(0, 0, 0, w, h, "Code Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0,0,0,w,h)
If StartVectorDrawing(CanvasVectorOutput(0))
AddPathBox(0,0, GadgetWidth(0),GadgetHeight(0))
VectorSourceColor(RGBA(120,120,120,255))
FillPath()
Object0(0,-50)
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow