Getting cylindrical co-ordinates for vertices


Some times it is useful to have the location of vertices in a cylindrical co-ordinate system. But in Gambit the vertices
position is given in Cartesian co-ordinate system.


This template can be used to get the vertex position in cylindrical system, but there are some limitations like, the cylindrical aixs should be aligned to one of the cartesian co-ordinate axis.
Save this file as a .jou file and run it in a Gambit session. The icon will be present under vertex, beside Slide virtual vertex icon.


******Journal file***********
dgui createform "cylinder"
formtitle "Select Vertex"
position 3
actionbuttons

"Close" "dgui hideitem "cylinder"" ""
"Apply" "macrorun name "calculate"" ""

dgui hookup "113" formname "cylinder"

dgui createitem "cylinder" picker vertex labelname "Vertex"
name "pickvertex" parameter "vertex_name"
single


/ activatecb "macrorun name "calculate""



/-------------------------------------------------

macro start "calculate"

declare $a [1:3]


$a=ENT2LOC($vertex_name)

declare $new [0:3]
$new[0]=sqrt($a[1]*$a[1]+$a[2]*$a[2])
$new[1]=atan($a[2]/$a[1])
$new[2]=$a[3]

$text1=" Cylindrical Coordinates for the vertex are: "
$text2= ntos($new[0])
$text3= ntos($new[1])
$text4= ntos($new[2])

$final_text=$text1 + $text2 + " " + $text3 + " " + $text4

dgui message $final_text
information onlytext

macro end

/----------------------------------------------





Show Form
No comments yet. Be the first to add a comment!