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
26
votes
2 answers

How to deduce the return type of a function object from parameters list?

I'm trying to write a projection function that could transform a vector into a vector. Here is an example: auto v = std::vector {1, 2, 3, 4}; auto r1 = select(v, [](int e){return e*e; }); // {1, 4, 9, 16} auto r2 = select(v, [](int…
Marius Bancila
  • 16,053
  • 9
  • 49
  • 91
25
votes
2 answers

What is a Projection in NHibernate?

I have a project where I'm using NHibernate to handle bindings to the database. So far I have mostly been using the basics when it comes to queries. Now I'm struggling with a more difficult query, and I notice new parts of NHibernate. In particular…
stiank81
  • 25,418
  • 43
  • 131
  • 202
24
votes
6 answers

C#: Altering values for every item in an array

I'm wondering if there is built-in .NET functionality to change each value in an array based on the result of a provided delegate. For example, if I had an array {1,2,3} and a delegate that returns the square of each value, I would like to be able…
JustOnePixel
  • 689
  • 1
  • 7
  • 16
24
votes
3 answers

Projecting a field that doesn't always exist

Is there a way to project fields that may or may not exist? Such as having it defined as null or undefined? For instance, I have a query with: $project: { date: 1, name: "$person.name", age: "$person.age" } Not all documents are…
Peter Sampson
  • 530
  • 2
  • 5
  • 14
22
votes
6 answers

Hibernate Query By Example and Projections

To make it short: hibernate doesn't support projections and query by example? I found this post: The code is this: User usr = new User(); usr.setCity = 'TEST'; getCurrentSession().createCriteria(User.class) .setProjection( Projections.distinct(…
Miguel Ping
22
votes
1 answer

How to set QGraphicsScene/View to a specific coordinate system

I want to draw polygons in a QGraphicsScene but where the polygons has latitude/longitude positions. In a equirectangular projection the coordinates goes from: ^ 90 | …
QLands
  • 2,424
  • 5
  • 30
  • 50
21
votes
2 answers

How to build perspective projection matrix (no API)

I develop a simple 3D engine (Without any use of API), successfully transformed my scene into world and view space but have trouble projecting my scene (from view space) using the perspective projection matrix (OpenGL style). I'm not sure about the…
reznic
  • 281
  • 1
  • 3
  • 5
20
votes
4 answers

"java.lang.IllegalArgumentException: Projection type must be an interface" Error

I am having difficulty in implementing projection in Spring Data JPA: 2017-10-19 11:31:33.968 ERROR 4272 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw…
lamostreta
  • 2,359
  • 7
  • 44
  • 61
19
votes
1 answer

How to work with DTO in Spring Data REST projects?

Spring Data REST automates exposing only domain object. But most often we have to deal with Data Transfer Objects. So how to do this in SDR way?
Cepr0
  • 28,144
  • 8
  • 75
  • 101
19
votes
1 answer

CQRS event store aggregate vs projection

In a CQRS event store, does an "aggregate" contain a summarized view of the events or simply a reference to the boundary of those events? (group id) A projection is a view or representation of events so in the case of an aggregate representing a…
webish
  • 701
  • 2
  • 9
  • 17
19
votes
10 answers

Mercator longitude and latitude calculations to x and y on a cropped map (of the UK)

I have this image. It's a map of the UK (not including Southern Ireland): I have successfully managed to get a latitude and longitude and plot it onto this map by taking the leftmost longitude and rightmost longitude of the UK and using them to…
betamax
  • 13,431
  • 9
  • 38
  • 55
18
votes
1 answer

Using Projections in JPA 2

I need to convert a Hibernate criteria query like the following curList = session.createCriteria(Islem.class) .createAlias("workingDay", "d") .setProjection(Projections.sum("amount")) …
Skyhan
  • 871
  • 3
  • 15
  • 26
18
votes
2 answers

How to instantiate and apply directives programmatically?

I know that in ng2 we have ComponentFactoryResolver that can resolve factories that we can apply to a ViewContainerRef. But, is there something similar for directives? a way to instantiate them and apply them to the projected content from a…
lqbweb
  • 1,684
  • 3
  • 19
  • 33
18
votes
4 answers

true isometric projection with opengl

Is there a simple way to have isometric projection? I mean the true isometric projection, not the general orthogonal projection. (Isometric projection happens only when projections of unit X, Y and Z vectors are equally long and angles between them…
someone
  • 381
  • 3
  • 5
  • 14
17
votes
3 answers

How do I methodically choose the near clip plane distance for a perspective projection?

I have a 3D scene and a camera defined using gluPerspective. I have a fixed FOV, and I know the minimum distance of any geometry to the camera (it is a first-person view, so that is the minimum distance from the viewpoint to the character's…
Kevin Reid
  • 37,492
  • 13
  • 80
  • 108