読者です 読者をやめる 読者になる 読者になる

図心の計算

多角形の組み合わせとして多角形の図心を求める

[:W600] nspired basic: Define centroid2(verts)= Func :Local k,numverts,points,xg,yg,x,y,xc,yc,s,st :numverts:=((dim(verts))/(2)) :points:=exact(augment(verts,{verts[1],verts[2]})) :For k,1,((dim(points))/(2)) :x[k]:=points[2*k-1]:y[k]:=poi…

多角形の図心を求める(nspired lua)

function centroid(vertsList) local numVerts = #vertsList/2 local points = vertsList table.insert(points, vertsList[1]); table.insert(points, vertsList[2]) local x, y = {}, {} for i = 1, #points/2 do x[i], y[i] = points[2*i-1], points[2*i] …

多角形の図心を求める(nspired basic)

Define polycenter(verts)= Prgm :Local k,numverts,points,xg,yg,x,y,xc,yc,s,st :numverts:=((dim(verts))/(2)) :points:=exact(augment(verts,{verts[1],verts[2]})) :For k,1,((dim(points))/(2)) :x[k]:=points[2*k-1] :y[k]:=points[2*k] :EndFor :xc:…