As above, any tricky methods to do so? Since you cannot pass an array, I wonder how to return coordinates (x/column and y/row) to the calling object. Regards.
44049
Is there a preferred way to return multiple values from a C++ function?  For example, imagine a function that divides two integers and returns both the quotient and the remainder.  One way I commonly see is to use reference parameters:  void divide(int dividend, int divisor, int&amp; quotient, int&amp; remainder);   A variation is to return one value and pass the other through a reference parameter:  int divide(int dividend, int divisor, int&amp; remainder);   Another way would be to declare a struct to contain all of the results and return that:  struct divide_result {     int quotient;     int remainder; };  divide_result divide(int dividend, int divisor);   Is one of these ways generally preferred, or are there other suggestions?  Edit: In the real-world code, there may be more than two results.  They may also be of different types.
121882
Do you know of a way to take surveyor's calls from an excel file (for example: N35-45-15W 60.0 ft, etc) and have them generate polygon shapefiles point by point in GIS? I know you can easily do this with point features that have coordinates, but I am trying to figure out how to build full polygons (without XY coordinate information, just surveyor's calls).
112610
I need to get the x,y,z values of an object as well as the bounding box through a script. So far I have the area and volume with the following code:  bm = bmesh.new() bm.from_object(bpy.context.object, bpy.context.scene) area = str(sum(f.calc_area() for f in bm.faces)) volume = str(bm.calc_volume())   I tried something like this for the bounding box:  bb = str(bm.dimensions())   or  bb = bpy.data.objects["test2-2"].dimensions   but neither have worked. As far as the x,y,z values go I'm stumped. Please let me know if you have any suggestions.  Thanks!
69554
I am trying to get coordinates from a mouse click in QGIS 3 and python 3 using the plugin builder.  I have tried using the response , and i can manage to get the coordinates printed to the python console in QGIS but at the same time i get the message that "'TypeError: 'QgsMapToolEmitPoint' object is not iterable" or "'QgsMapToolEmitPoint' object does not support indexing"   I can't remember i ever seen a python program causing an error but still manage to compute and output the wanted result. The "not iterable" error traces back to the line with the for loop "for point in ... " the "does not support indexing" error is caused if i do e.g. x = pointTool[0]  Here is a version of the code:  from qgis.gui import QgsMapToolEmitPoint   def display_point(pointTool):     #print(pointTool)     cood = []     for point in pointTool:         cood.append(point)     print(cood)  # a reference to our map canvas canvas = iface.mapCanvas()  # this QGIS tool emits as QgsPoint after each click on the map canvas pointTool = QgsMapToolEmitPoint(canvas)  pointTool.canvasClicked.connect(display_point)  canvas.setMapTool(pointTool)  display_point(pointTool)
3046
Assuming I have an ArrayList  ArrayList&lt;MyClass&gt; myList;   And I want to call toArray, is there a performance reason to use  MyClass[] arr = myList.toArray(new MyClass[myList.size()]);   over  MyClass[] arr = myList.toArray(new MyClass[0]);   ?  I prefer the second style, since it's less verbose, and I assumed that the compiler will make sure the empty array doesn't really get created, but I've been wondering if that's true.  Of course, in 99% of the cases it doesn't make a difference one way or the other, but I'd like to keep a consistent style between my normal code and my optimized inner loops...
70957
I have the following TikZ code which draws a grid and shows the coordinates.  To display the coordinates I am using the loop foreach.  \documentclass[12pt]{article} \usepackage{tikz}  \begin{document} \begin{tikzpicture} \draw[help lines,step=.2] (-2,-2) grid (7,4); \draw[help lines,line width=.6pt,step=1] (-2,-2) grid (7,4); \foreach \x in {-2,-1,0,1,2,3,4,5,6,7}  \node[anchor=north] at (\x,-2) {\x}; \foreach \y in {-2,-1,0,1,2,3,4}  \node[anchor=east] at (-2,\y) {\y}; \end{tikzpicture} \end{document}   Is there a way do simplify the code in this way that I have a key like show coordinates (maybe step coordinates/.initial=step ):  \draw[help lines,step=.2,show coordinates=true] (-2,-2) grid (7,4);   Or a modification of the command grid like  \draw[help lines,step=.5] (-2,-2) gridwithcoordinates (7,4);     By using pstricks it is very simple with the command \psgrid  \documentclass[12pt]{article} \usepackage{pstricks}  \begin{document} \begin{pspicture}(-2,-2)(7,4) \psgrid \end{pspicture} \end{document}   Bonus: How can I set a larger line width for the help lines at the integer coordinates (see picture above)?  (I don't know the correct words ;-) )
63994
I am trying to locate the vertices of a rectangle and to color the rectangular region.  I specify the y-coordinate as a function value, like \sqrt{3}/2 or \sin(60).  I am getting an error.  \documentclass{amsart} \usepackage{tikz} \usetikzlibrary{calc}   \begin{document} \begin{tikzpicture}  \coordinate (A) at (-1,{-\sqrt{3}/2}); \coordinate (B) at (-1,{\sin(60)}); \coordinate (C) at (2,{\sin(60)); \coordinate (D) at (2,{-\sqrt{3}/2});  \path[fill=yellow] (A) -- (B) -- (C) -- (D) -- cycle;  \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below left:$A$}] at (A) {}; \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above left:$B$}] at (B) {}; \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]above right:$C$}] at (C) {}; \node[outer sep=0pt,circle, fill,inner sep=1.5pt,label={[fill=white]below right:$D$}] at (D) {}; \end{tikzpicture}
100544
I'm trying to get the First Point coordinates (x,y) and Final Point coordinates (x2,y2) from a polyline in ArcGIS 10 with the Field calculator.  I've added 4 (double) fields like StartX,StartY,EndX and EndY,I tried with:  "!Shape!.positionAlongLine(0.0,True).firstPoint.X" "!Shape!.positionAlongLine(0.0,True).firstPoint.Y" "!Shape!.positionAlongLine(1.0,True).firstPoint.X" "!Shape!.positionAlongLine(1.0,True).firstPoint.Y"   But no luck. The error: "The row contains a bad value".  What am I doing wrong?   Thanks to @radouxju for your answer because it was what I was looking for!!, but NOW I don't know What's happening with my ArcGIS10. Let's see:  I could compute all these statements (4), to every field:   "!Shape!.lastPoint.X" "!Shape!.lastPoint.Y"...   But, after that I checked for errors and I found this! That there are times that the ArcGIS field calculator doesn't compute well. In the example, the yellow one, it's 16 meter long, but its coordinates are the same, but the the next polyline is well computed... What's happening?
26106
I have webservice which is passed an array of ints. I'd like to do the select statement as follows but keep getting errors. Do I need to change the array to a string?  [WebMethod] public MiniEvent[] getAdminEvents(int buildingID, DateTime startDate) {         command.CommandText = @"SELECT id,                             startDateTime, endDateTime From                             tb_bookings WHERE buildingID IN                             (@buildingIDs) AND startDateTime &lt;=                             @fromDate";      SqlParameter buildID = new SqlParameter("@buildingIDs", buildingIDs); }
90192
I have an object that I want to make a square array like a 3x3x3 cube. I want be able to change length and count for one axis and have all the other ones follow.
70797
I was shocked to find out today that C# does not support dynamic sized arrays. How then does a  developer used to using  deal with this in C#?  At the beginning of the function I am not sure of the upper bound of the array. This depends on the rows returned from the database.
58742
I am unable to get the right coordinate values for (A) and (B) in the following axis. Did I misunderstand some conversion step or is it because of the data?  Picture    MWE  \documentclass[ a4paper ]{scrartcl}  \usepackage{     newtxtext,     amsmath,     tikz,     pgfplots } \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}  \usetikzlibrary{     calc }  \listfiles  \begin{document}  \begin{center}     \begin{tikzpicture}[font=\small]     \begin{axis}[     height=6cm,     width=14cm,     %     scale only axis=true,     xlabel={Distance in mm},     ylabel={Voltage in volt},     ]     \addplot [sharp plot, no marks, x=Wegnormiert] table [col sep=tab] {data.txt} coordinate [pos=0.5] (A) coordinate [pos=0.6] (B);     \draw (A) -| (B);     \filldraw let \p1= (A) in (\x1,\y1) circle [radius=1pt] node[pin={[pin distance=1.1cm]270:{{\pgfmathparse{\x1}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,pt}}}] {};     \filldraw let \p2= (B) in (\x2,\y2) circle (1pt) node[yshift=-0.5cm, pin=270:{{\pgfmathparse{\x2/2.845274}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,mm}}] {};     \end{axis}     \end{tikzpicture} \end{center}  \end{document}   Data    Additional  code for y-coordinate  \documentclass[ a4paper ]{scrartcl}  \usepackage{     newtxtext,     amsmath,     subcaption,     biblatex } \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}  \usepackage{     tikz,     pgfplots     } \usetikzlibrary{     calc }  \listfiles  \begin{document}  \begin{center}     \centering     \begin{tikzpicture}[font=\small]     \begin{axis}[     height=6cm,     width=14cm,     %     scale only axis=true,      xlabel={Distance in mm},      ylabel={Voltage in volt},     ]     \addplot [sharp plot, no marks, x=Wegnormiert] table [col sep=tab] {data.txt} coordinate [pos=0.5] (A) coordinate [pos=0.6] (B);     \draw (A) -| (B); %   \filldraw let \p1= (A) in (\x1,\y1) circle [radius=1pt] node[pin={[pin distance=1.1cm]270:{{\pgfmathparse{\x1}\pgfmathprintnumber[fixed,precision=2]{\pgfmathresult}\,pt}}}] {};     \filldraw let \p2= (B) in (\x2,\y2) circle (1pt) node[yshift=-0.5cm, pin=270:{{\pgfplotsconvertunittocoordinate{x}{\x2}\pgfmathprintnumber[fixed,precision=1]{\pgfmathresult}}}] {} node[yshift=0.5cm, pin={355:{{\pgfplotsconvertunittocoordinate{y}{\y2}\pgfmathprintnumber[fixed,precision=1]{\pgfmathresult}}}}] {};     \end{axis}     \end{tikzpicture} \end{center}  \end{document}
85308
Possible Duplicate:             How to use x coordinate of a point and y coordinate of other point? I need similar to  \coordinate (A) at (2,1); \coordinate (B) at (3,0); \coordinate (C) at (4,3); \coordinate (D) at (5,-1);  \draw (xA,yB) -- (xC,yD);
88016
I've spent more time than I should trying to get my ray picking program working. I'm pretty convinced my math is solid with respect to line plane intersection, but I believe the problem lies with the changing of the mouse screen touch into 3D world space.  Heres my code:      public void passTouchEvents(MotionEvent e){           int[] viewport = {0,0,viewportWidth,viewportHeight};         float x = e.getX(), y = viewportHeight - e.getY();          float[] pos1 = new float[4];         float[] pos2 = new float[4];         GLU.gluUnProject(   x, y, 0.0f,                             mViewMatrix, 0,                             mProjectionMatrix, 0,                             viewport, 0,                             pos1, 0);           GLU.gluUnProject(   x, y, 1.0f,                             mViewMatrix, 0,                             mProjectionMatrix, 0,                             viewport, 0,                             pos2, 0);     }   Just as a reference I've tried transforming the coordinates 0,0,0 and got an offset.  It would be appreciated if you would answer using OpenGL ES 2.0 code.
46903
Whenever I use ScreenToWorldPoint(Input.mousePosition) and display the output in console this always gives me the same coordinates. MyCode: Vector3 screenToWorld;  void Update() {     screenToWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);     Debug.Log(screenToWorld); }
77477
I am trying to dynamically create a data table with two arrays (SObject array and a String array which has field API name).  The two arrays are Contact[] and String[], where String[] consists of ["Id", "Name"].  What I've tried dot notation and square bracket notation but neither worked.  &lt;!-- row --&gt; &lt;aura:iteration item="{!v.contacts} var="contact"&gt;     &lt;!-- column --&gt;     &lt;aura:iteration item="{!v.fieldNames} var="fieldName"&gt;         {!contact.fieldName}          {!contact[fieldName]}     &lt;/aura:iteration&gt; &lt;/aura:iteration&gt;   Not quite sure what is the correct approach to do this.
109685
In the question , a very nice solution was given for typesetting a column vector with an arbitrary number of rows. I am attempting to modify the code to produce row vectors instead of column vectors. I made the "obvious" change, i.e., substituting the &amp; for the \\ as indicated by the snippet below:  \newcount\colveccount \newcommand*\colvec[1]{         \global\colveccount#1         \begin{pmatrix}         \colvecnext } \def\colvecnext#1{         #1         \global\advance\colveccount-1         \ifnum\colveccount>0                 &amp;                 \expandafter\colvecnext         \else                 \end{pmatrix}         \fi } My modification however fails to compile and the errors, of course, are not very helpful. So my question is, How can I modify the \colvec and \colvecnext macros to produce row vectors?