Questions tagged [projection]

A projection is the transformation of a set of data from one form into another.

Mathematically speaking a projection is a function that yields the same result if applied multiple times.

The term is used with this meaning in graphics when 'projecting' a 3D scene on a 2D canvas.

The same is often happening when analyzing data with many dimensions (age, gender, number of transactions, ...) and projecting it on fewer dimensions, in the simple case by just dropping dimensions or by creating new dimensions like (might commit fraud).

When dealing with typed languages the dimensions might be attributes of a class. So if I have one or multiple types with attributes (A, B, C, ...) and create from instances of those types instances of a type which has only the attributes (A, B) this is a projection too.

Another example are databases. A projection is an operation which discards some attributes of a tuple, in other words, which omits some columns of a relational database query result. For an object or document database a projection filters out some fields.

After all a database projection yields the same result if applied multiple times, too.

2017 questions
476
votes
19 answers

Retrieve only the queried element in an object array in MongoDB collection

Suppose you have the following documents in my collection: { "_id":ObjectId("562e7c594c12942f08fe4192"), "shapes":[ { "shape":"square", "color":"blue" }, { "shape":"circle", …
Sebtm
  • 7,002
  • 8
  • 29
  • 32
380
votes
25 answers

How to select a single field for all documents in a MongoDB collection?

In my MongoDB, I have a student collection with 10 records having fields name and roll. One record of this collection is: { "_id" : ObjectId("53d9feff55d6b4dd1171dd9e"), "name" : "Swati", "roll" : "80", } I want to retrieve the field…
Shipra Swati
  • 3,999
  • 2
  • 14
  • 7
85
votes
10 answers

Mouse / Canvas X, Y to Three.js World X, Y, Z

I've searched around for an example that matches my use case but cannot find one. I'm trying to convert screen mouse co-ordinates into 3D world co-ordinates taking into account the camera. Solutions I've found all do ray intersection to achieve…
Rob Evans
  • 6,750
  • 4
  • 39
  • 56
56
votes
7 answers

correcting fisheye distortion programmatically

BOUNTY STATUS UPDATE: I discovered how to map a linear lens, from destination coordinates to source coordinates. How do you calculate the radial distance from the centre to go from fisheye to rectilinear? 1). I actually struggle to reverse it,…
Will
  • 73,905
  • 40
  • 169
  • 246
52
votes
8 answers

Calculating a LookAt matrix

I'm in the midst of writing a 3d engine and I've come across the LookAt algorithm described in the DirectX documentation: zaxis = normal(At - Eye) xaxis = normal(cross(Up, zaxis)) yaxis = cross(zaxis, xaxis) xaxis.x yaxis.x …
Dominik Grabiec
  • 10,315
  • 5
  • 39
  • 45
42
votes
2 answers

How exactly does OpenGL do perspectively correct linear interpolation?

If linear interpolation happens during the rasterization stage in the OpenGL pipeline, and the vertices have already been transformed to screen-space, where does the depth information used for perspectively correct interpolation come from? Can…
AIGuy110
  • 1,025
  • 1
  • 10
  • 11
42
votes
4 answers

Projecting into KeyValuePair via EF / Linq

I'm trying to load a list of KeyValuePairs from an EF / Linq query like this: return (from o in context.myTable select new KeyValuePair(o.columnA, o.columnB)).ToList(); My problem is that this results in the error "Only…
GrandMasterFlush
  • 6,269
  • 19
  • 81
  • 104
36
votes
2 answers

Spring Data JPA Projection selected fields from the DB

I was testing Spring Data 1.10.4.RELEASE, following the example in Spring Data Docs http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections and I noticed some issues for which I have 2 questions. First let's suppose I have…
arammal
  • 393
  • 1
  • 4
  • 11
36
votes
5 answers

How to call fromLatLngToDivPixel in Google Maps API V3?

I know that method exists and is documented, but I don't know how to get an MapCanvasProjection object.
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
34
votes
8 answers

How to use $elemMatch on aggregate's projection?

This is my object: { "_id" : ObjectId("53fdcb6796cb9b9aa86f05b9"), "list" : [ "a", "b" ], "complist" : [ { "a" : "a", "b" : "b" }, { "a" : "c", "b" : "d" } ] } And this is what I want to accomplish: check if "list" contains a certain element and…
Stephen Lynx
  • 1,077
  • 2
  • 14
  • 29
33
votes
2 answers

Why are interface projections much slower than constructor projections and entity projections in Spring Data JPA with Hibernate?

I've been wondering which kind of projections should I use, so I did a little test, which covered 5 types of projections (based on docs: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections): 1. Entity projection This is…
Sikor
  • 11,628
  • 5
  • 28
  • 43
33
votes
3 answers

What exactly are eye space coordinates?

As I am learning OpenGL I often stumble upon so-called eye space coordinates. If I am right, you typically have three matrices. Model matrix, view matrix and projection matrix. Though I am not entirely sure how the mathematics behind that works, I…
danijar
  • 32,406
  • 45
  • 166
  • 297
32
votes
5 answers

Spring JPA native query with Projection gives "ConverterNotFoundException"

I'm using Spring JPA and I need to have a native query. With that query, I need to get only two fields from the table, so I'm trying to use Projections. It isn't working, this is the error I'm getting: …
nonzaprej
  • 1,322
  • 2
  • 21
  • 30
31
votes
6 answers

2D outline algorithm for projected 3D mesh

Given: A 3D mesh defined with a set of vertices and triangles building up the mesh with these points. Problem: Find the 2d outline of the projected arbitrarily rotated mesh on an arbitrary plane. The projection is easy. The challenge lies in finding…
rtn
  • 127,556
  • 20
  • 111
  • 121
27
votes
8 answers

Basic render 3D perspective projection onto 2D screen with camera (without opengl)

Let's say I have a data structure like the following: Camera { double x, y, z /** ideally the camera angle is positioned to aim at the 0,0,0 point */ double angleX, angleY, angleZ; } SomePointIn3DSpace { double x, y, z } ScreenData { …
Berlin Brown
  • 11,504
  • 37
  • 135
  • 203
1
2 3
99 100