Questions tagged [cartesian]

Don't use this tag. If you have questions about cartesian products (e.g. SQL, Spark, Datatables, heterogeneous tuples), use `cartesian-product` tag. If you have questions about planar geometry / 3D-graphics, use `cartesian-coordinates` tag.

245 questions
2
votes
1 answer

Efficient axis-wise cartesian product of multiple 2D matrices with Numpy or TensorFlow

So first off, I think what I'm trying to achieve is some sort of Cartesian product but elementwise, across the columns only. What I'm trying to do is, if you have multiple 2D arrays of size [ (N,D1), (N,D2), (N,D3)...(N,Dn) ] The result is thus to…
undercurrent
  • 285
  • 1
  • 2
  • 12
2
votes
2 answers

Polar to Cartesian coordinates function not outputting the correct data

I have a flight path with lat/long and elevation and I need to convert this to cartesin X,Y,Z for cesium.js. I am running into the wall trying to convert this because I don't seem to be getting the right results from my function. var R =…
now_world
  • 940
  • 7
  • 21
  • 56
2
votes
0 answers

How to avoid Cartesian product when query the path between any two nodes?

I have two types nodes in my graph. 70k ARTICLE, 10k DOCTOR and 20K relationships between the nodes. I want to query all the shortest path in the graph and then filt the longest 2 path. But there is Cartesian product in the query plan and the…
L.Leo
  • 91
  • 1
  • 1
  • 3
2
votes
4 answers

More generic lisp code to generate combinations of pairs

Given this sad thing below, which generates all pairs of only two ranges - [53]> (setq thingie '()) NIL [54]> (loop for i in (generate-range 0 3) do (loop for j in (generate-range 4 6) do (push (list i j) thingie))) NIL [55]> thingie ((3 6) (3…
Paul Nathan
  • 39,638
  • 28
  • 112
  • 212
2
votes
1 answer

PHP GD convert coordinates from Polar to Cartesian

I want to show percentages near or over each parts of the chart. Do I have to convert coordinates from Polar to Cartesian? To convert polar coordinates (r, θ) to rectangular coordinates (x, y) I used the following conversion: x = r * cos( θ ) y = r…
sandra
  • 29
  • 2
2
votes
2 answers

Explicit sort in Cartesian transformation in Scala Spark

I am using Cartesian transformation in Spark Scala. If my input consists of 4 elements (could be numbers/characters/tuple) say var myRDD=sc.parallelize(Array("e1","e2","e3","e4")) myRDD.cartesian(myRDD) would yield all possible combination of pairs…
Kent Carlevi
  • 133
  • 1
  • 11
2
votes
2 answers

Slicing two squares in half equally on a cartesian plane (finding midpoint)

I am working through the solution to the following problem: Given two squares on a two-dimensional plane, find a line that would cut these two squares in half. Assume that the top and the bottom sides of the square run parallel to the…
ApathyBear
  • 9,057
  • 14
  • 56
  • 90
2
votes
2 answers

In c++, how do I create point locations arbitrarily?

I'm trying to program a simulation. Originally I'd randomly create points like so... for (int c = 0; c < number; c++){ for(int d = 0; d < 3; d++){ coordinate[c][d] = randomrange(low, high); } } Where randomrange() is an…
Captain Morgan
  • 233
  • 1
  • 9
2
votes
3 answers

Read CSV file, manipulate columns and append result in new column. Python 2.7

I am having some trouble attempting to manipulate a CSV file and appending the results to a new column. Essentially I have a csv file (delimited ;) with 5 columns currently (of Cartesian coords [X, Y] and components [dX, dY], and magnitude/ length).…
MACooperr
  • 75
  • 1
  • 8
2
votes
1 answer

Iphone Animation - Calculation to plot Cartesian Coordinates

I have two points (x1, y1) A & (x2, y2) B. I want to animate an image from point A to point B but also have a touch event on that image. What is the best way to accomplish this? I am currently using CGPointMake to manually plot points but I want to…
ceuyan
  • 21
  • 1
2
votes
3 answers

Left outer join on aggregate queries

So I have two payment tables that I want to compare in a Oracle SQL DB. I want to compare the the total payments using the location and invoice and total payments. It's more comlex then this but basically it is: select tbl1.location, …
user3095951
  • 45
  • 1
  • 4
2
votes
1 answer

Simplest way to render a Cartesian grid and points with Ruby?

So I've been messing with Ruby trying to make a sort of chicken simulator. I have all these instances of class Chicken with @x and @y variables which represent their position. They have methods like step(direction,steps), distance_from(object),…
user2493615
  • 317
  • 1
  • 8
2
votes
1 answer

The set of all combinations of vectors in Python

I'm having an issue with regards to creating what can be seen as the cartesian product of an array of vectors in Python. I have a code that gives the all possible partitions of a number n over r variables, and returns it as a numpy array. What I…
2
votes
2 answers

Trying to convert longitude/latitude to Cartesian coordinates

i am trying to convert a city's longitude/latitude position to Cartesian so i can then convert it to pixel position to display on a pygame screen, but i am having trouble figuring it out. def ConvertPoint(self, Long, Lat, height, width): self.x…
CRS
  • 827
  • 2
  • 13
  • 20
1
vote
3 answers

convert bounding box coordinates to x,y pairs

I have a bounding box coordinates in this format [x, y, width, height], how can I get all the x and y pairs from it? the result is going to be in this format [(x1,y1),(x2,y2),...,(xn,yn)] thanks in advance!