projection

What are good reasons to enable 2D projection with cocos2d-iphone?

人盡茶涼 提交于 2019-12-01 06:12:33
In cocos2d-iphone the default projection type is "3D" projection. But you can also set the projection to "2D" like so: [[CCDirector sharedDirector] setProjection:CCDirectorProjection2D]; Behind the scenes the 3D projection uses perspective projection whereas 2D projection is the OpenGL orthographic projection. The technical details about these two projection modes can be reviewed here , that's not what I'm interested in. What are the benefits and drawbacks of 2D projection for cocos2d users? What are good reasons to switch to 2D projection? Personally I've used 2D projection to be able to use

Projecting a 3D point to 2D screen space using a perspective camera matrix

雨燕双飞 提交于 2019-12-01 04:20:05
I am attempting to project a series of 3D points onto the screen using a perspective camera matrix. I do not have world space (or consider it being an identity matrix) and my camera does not have camera space (or consider it an identity matrix), I do have a 4x4 matrix for my object space. I am taking the object matrix and multiplying it by the camera perspective matrix, generated with the following method: Matrix4 createPerspectiveMatrix( Float fov, Float aspect, Float near, Float far ) { Float fov2 = (fov/2) * (Math.PI/180); Float tan = Math.tan(fov2); Float f = 1 / tan; return new Matrix4 (

Projecting into KeyValuePair via EF / Linq

£可爱£侵袭症+ 提交于 2019-12-01 02:04:45
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<int, string>(o.columnA, o.columnB)).ToList(); My problem is that this results in the error "Only parameterless constructors and initializers are supported in LINQ to Entities." Is there an easy way around this? I know I could create a custom class for this instead of using KeyValuePair but that does seem like re-inventing the wheel. Select only columnA and columnB from your table, and move further processing in memory: return context.myTable .Select(o => new {

Return entity via projection query

感情迁移 提交于 2019-11-30 23:37:37
Is it possible to return an entity using a projection query? I've successfully done it with a SQL query (see below), but can't find how to do it with a projection query. Dim sql As String = "SELECT {a.*}, {b.*} FROM a LEFT OUTER JOIN b ON a.pk = b.fk") ' Convert SQL results into entities {a} and {b} Dim query As IQuery = session.CreateSQLQuery(sql) _ .AddEntity("a", GetType(a)) _ .AddEntity("b", GetType(b)) Return query.List() Yes, you can return entities from projection queries. If you are using a HQL query you can specify a constructor for the given class in the HQL select clause: IList<Foo>

Grails: Projection on many tables?

假装没事ソ 提交于 2019-11-30 20:20:24
I have some problems with projection in Grails. Could you please help me review them and suggest solutions for me? I want to query data on many tables which has many-to-one relationship and projection on some properties on both of them. For example: class Person { int id String name String address static hasMany = [cars : Car] } class Car { int id String brand long price Person owner static belongsTo = [owner : Person] } So, how can I use just one query withCriteria (apply projection) to get information of a specified car (include brand, price, and the owner name)? Is it possible to use: Car

Projection of a plane onto a cylinder

杀马特。学长 韩版系。学妹 提交于 2019-11-30 18:11:13
I have a plain bitmap and I want to do a projection on a cylinder. That means, I want to transform the image in a way so that if I print it and wrap around a columnar cylinder and photograph it from a certain position, the resulting image looks like the original. Still I'm quite lost in all the projection algorithms (that are often related to earth projections). So I'd be thankful for hints what the correct algorithm could be and which tools I could use to apply it to my image. Let say you have a rectangle image of lenght: L and height: H . and a cylinder of radius : R and height H' Let A (x,z

Radius of projected Sphere

徘徊边缘 提交于 2019-11-30 15:39:11
i want to refine a previous question : How do i project a sphere onto the screen? (2) gives a simple solution: approximate radius on screen [CLIP SPACE] = world radius * cot(fov / 2) / Z with: fov = field of view angle Z = z distance from camera to sphere result is in clipspace , multiply by viewport size to get size in pixels Now my problem is that i don't have the FOV. Only the view and projection matrices are known. (And the viewport size if that does help) Anyone knows how to extract the FOV from the projection matrix? Update: This approximation works better in my case: float radius = glm:

How do I apply a projection to a Spring Data REST query method resource?

夙愿已清 提交于 2019-11-30 13:27:54
I'm using Spring Data REST 2.1.4.RELEASE. I created an entity Booking , its REST repository (extending CrudRepository ) named BookingRepository and a projection BookingDetails (annotated with @Projection(name="details", types = Booking.class) ) for returning some of its linked entities exploded, such as Resource , Activity , Applicant etc. The client gets all bookings with .../rest/bookings and the JSON response includes links for the linked entities. If it adds ?projection=details then the linked entities are exploded and returned. And this is great. Now I add this custom method to the

Using Projections in JPA 2

断了今生、忘了曾经 提交于 2019-11-30 12:43:32
问题 I need to convert a Hibernate criteria query like the following curList = session.createCriteria(Islem.class) .createAlias("workingDay", "d") .setProjection(Projections.sum("amount")) .add(Restrictions.eq("currency", CURRENCY)) .add(Restrictions.eq("product", product)) .add(Restrictions.ne("status", INACTIVE)) .add(Restrictions.eq("d.status", ACTIVE)) .getResultList(); However in JPA (2) I have no idea how to implement the projection - in this case - the sum. It's odd that Hibernate and JPA

3D Scene transformations not quite working

有些话、适合烂在心里 提交于 2019-11-30 10:01:24
问题 In an attempt to convert screen space coordinates into world space coordinates, I've been doing the following calculation: WorldSpace Vector = inverse(Projection Matrix) * inverse(View Matrix) * ScreenSpace vector Up to this point, I believe I have most of my calculations right, however I'm unsure of how to perform the last step needed in order to have my vector transformed to world coordinates. Problem: I've been told that the last step of this process is to divide my results by the variable