Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw cones dynamically by TE

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how TE dynamically plots cones, which is very detailed and has a certain reference value. Friends who are interested must read it!

In the secondary development of TE, the three-dimensional cone can be plotted, and the conical drawing can be carried out in accordance with the way operated in TE.

The implementation of the javascript code in BS is as follows:

Events to add actions:

/ / left button, right button, real-time refresh

Sgworld.AttachEvent ("OnLButtonDown", OnLButtonDown)

Sgworld.AttachEvent ("OnRButtonDown", OnRButtonDown)

Sgworld.AttachEvent ("OnFrame", OnFrame)

/ / left button event

Function OnLButtonDown (Flags,X,Y)

{

/ / the sign of whether to start plotting

If (cflag)

{

Var Iwordpoint= sgworld.Window.PixelToWorld (Xmeny Yphai0)

If (Cone==null)

{

Var nLineColor = 0xFF0000FF

/ / create a conical object

Cone=sgworld.Creator.CreateCone (Iwordpoint.Position,1,0,nLineColor,nLineColor,12,0, "circle")

}

Else

{

Var dis = sgworld.CoordServices.GetDistance (Cone.Position.X, Cone.Position.Y, Iwordpoint.Position.X, Iwordpoint.Position.Y)

/ / judge the circle at the bottom first

If (hflag)

{

Var dis1 = sgworld.CoordServices.GetDistance (0, Cone.Position.Y, 0, Iwordpoint.Position.Y)

Cone.Height=dis

Cflag = false

}

/ / set the radius and height of the cone

If (Cone.Height = = 0 percent percent flag) {

Cone.Radius = dis

Cone.Height=dis

Hflag=true

}

}

}

}

/ / right-click event to end the cone drawing

Function OnRButtonUpp (Flags,X,Y)

{

Cflag = false

Cone=null

Hflag=false

}

/ / Real-time refresh event

Function Onframe ()

{

If (cflag)

{

/ / Radius transformation of the bottom circle

If (contains contains null)

{

Var Imousinfo = sgworld.Window.GetMouseInfo ()

Var Iwordpoint = sgworld.Window.PixelToWorld (Imousinfo.X, Imousinfo.Y, 0)

/ / change the radius according to the distance

Var dis = sgworld.CoordServices.GetDistance (Cone.Position.X, Cone.Position.Y, Iwordpoint.Position.X, Iwordpoint.Position.Y)

If (Cone.Height = = 0 percent percent flag) {

Cone.Radius = dis

}

If (hflag)

{

/ / height change

Var dis1 = Imethod.getdistance (0, Cone.Position.Y, 0, Iwordpoint.Position.Y)

Cone.Height=dis1

}

}

}

}

The above is all the content of the article "how to dynamically draw cones in TE". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report