How can I use the "distance"?

num_knot = numKnots $ 1
seg_len = getSegLengths $ 1
num_seg = num_knot-1
for i=1 to num_knot do
(
pt1 = getKnotPoint $ 1 i
pt2 = getKnotPoint $ 1 i+1
knot_len = distance pt1 pt2
messageBox ((knot_len as string)+","+(seg_len[i+num_seg] as string))
)

why the"knot_len" was always equal to "1.73205"?and the"knot_len" is same.so I need help.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
season_X's picture

Who did use Base64 Image for Button?

global Logo_image = "...."
local ConvertClass = dotnetclass "system.convert"
local ImageClass = dotnetclass "system.drawing.image"
fn ConvertBase64StringToImage string =
(
bytearr = convertclass.FromBase64String string
memstream = dotnetobject "System.IO.MemoryStream" bytearr
DecodedImg = ImageClass.fromstream memstream
memstream.close()
DecodedImg
)
btn_image = ConvertBase64StringToImage Logo_image
button Align_Right width:45 height:45 image:#(btn_image, undefined, 1,1,1,1,1)

-----Why didn't the image show?

miauu's picture

.

(
	num_knot = numKnots $ 1
	seg_len = getSegLengths $ 1
	num_seg = num_knot-1
	for i=1 to num_knot - 1 do
	(
		pt1 = getKnotPoint $ 1 i
		pt2 = getKnotPoint $ 1 (i+1)
		knot_len = distance pt1 pt2
		format "knots: %   knot_len: %   seg_len: % \n" #(i, i+1) knot_len seg_len[i+num_seg]
	)
)

The knot_len depends of the position of the knots. If they are placed so the distance between them is always "1.73205" then you will see "1.73205" as knot_len value.
The seg_len will be the same as knot_len if all segments are straight lines(itheir type is Line not Curve).

TsveTan's picture

.

maybe...
pt2 = getKnotPoint $ 1 i+1 should return to pt2 = getKnotPoint $ 1 (i+1), also for i = 1 to num_seg do to avoid out of range.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.