projection

BindingList projection wrapper

Is there a simple way to create a BindingList wrapper (with projection), which would update as the original list updates? For example, let's say I have a mutable list of numbers, and I want to represent them as hex strings in a ComboBox. Using this wrapper I could do something like this: BindingList<int> numbers = data.GetNumbers(); co...

How to find relation between change in latitudes at centre of map and top/bottom

Hi, Im having little trouble finding a relation between the movement at centre and edge of a circle, Im doing for panning world map,my map extent is 180,89:-180,-89, my map pans by adding change(dx,dY) to its extents and not its centre. Now a situation has arrrised where I have to move the map to a specific centre, to calculate the chan...

Map tiling - What kind of projection?

Hi. I've taken a large image and divided it in to square tiles (256x256). It is made for google maps also, so the whole image is divided into z_x_y.png (Depending on zoom level). z=0 => 1x1 tile z=1 => 2x2 tilesthe z=2 => 4x4 tiles My imageMap is "flat" and is not based on a sphere like the worldmap. I'm gonna use this map on a wind...

Plane projection and scale causing bluring in silverlight

Ok, So I've tried to make an application which relies on images being scaled by an individual factor. These images are then able to be turned over, but the use of an animation working on the ProjectionPlane rotation. The problem comes around when an image is both scaled and rotated. For some reason it starts bluring, where a non scaled...

Calculating which line is in front at the point where two line projections intersect

Two lines in 3d are projected onto 2d screen, and their projections intersect at a point which can be calculated. If the endpoints of the lines in 3d space are known and their intersection point in the projection plane is also known, how can I determine which line is in front at this intersection point? ...

correcting fisheye distortion programmatically

BOUNTY STATUS UPDATE: I discovered how to map a linear lens, from destination coordinates to source coordinates. I actually struggle to reverse it, and to map source coordinates to destination coordinates. What is the inverse, in code in the style of the converting functions I posted? I also see that my undistortion is imperfect ...

Howto project a planar polygon on a plane in 3d-space

I want to project my Polygon along a vector to a plane in 3d Space. I would preferably use a single transformation matrix to do this, but I don't know how to build a matrix of this kind. Given the plane's parameters (ax+by+cz+d), the world coordinates of my Polygon. As stated in the the headline, all vertices of my polygon lie in an...

Linq Projection Question

I'm trying to do the following: from c in db.GetAllContactsQuery() select new { ID= c.ID, LastName = c.LastName, FirstName = c.FirstName, Email = c.Email, City =c.City+" "+c.State } The issue i'm running into is that if c.City or c.State are null, the City property returns null. How can I put a function right beside tha...

Soft Shadows in Raytracing 3D to 2D

Hello: I wish to implement soft shadows produced by area lights in my raytracer. I'm having trouble generating the random samples. So I have a scene in which I have an area light (represented as a circle) whose world (x,y,z) coordinates of the center are given, the radius is given, the normal of the plane on which the circle lies is giv...

LinqToSql: How can I create a projection to adhere to DRY?

Just wondering if there is a way to take some of the repitition out of a LINQ to SQL projected type. Example: Table: Address Fields: AddressID, HouseNumber, Street, City, State, Zip, +20 more Class MyAddress: AddressID, HouseNumber, Street (Only 3 fields) LINQ: from a in db.Addresses select new MyAddress { AddressID = a.AddressI...

c++ opengl: how can i combine 2 different projection types for 3d graphics and 2d menus ?

Hi! I would like to use Oblique projection for menus and perspective projection for the 3d-scene. is there a way to combine between this two projections ? In general I'm asking how can I create menus in opengl for my 3d scene. Programming using the c++ language. Thanks! ...

Hibernate criteria query using Max() projection on key field and group by foreign primary key

I'm having difficulty representing this query (which works on the database directly) as a criteria query in Hibernate (version 3.2.5): SELECT s.* FROM ftp_status s WHERE (s.datetime,s.connectionid) IN (SELECT MAX(f.datetime), f.connectionid FROM...

How to get visible size of DisplayObject with perspective projection

The following is entirely a math question. As we know, PerspectiveProjection delivers perspective transformations in 3D represented by the interdependent values of fieldOfView and focalLength according to the following formula: focalLength = stageWidth/2 * (cos(fieldOfView/2) / sin(fieldOfView/2) Q: How to get the visible on-scree...

Orthogonal projection and texture coordinates in opengl

I'm writing a 2D game in Opengl. I already set up the orthogonal projection so I can easily know where a quad will end up on screen. The problem is, I also want to be able to map pixels directly to texture coords, so I also applied an orthogonal transformation (using gluOrtho2d) to the texture. Now I can map pixels directly using integer...

Get subclass type from projection with NHibernate

Hi I am trying to do a projection on a type called Log. Log references a superclass called Company. Each company type is mapped with table per subclass. Is it possible for me to get the type of Company when I do a projection on Log? I currently have an Enum property (which is not mapped) on each subclass, so I can perform switches on C...

How to retrieve row count of one-to-many relation while also including original entity?

Say I have two entities Foo and Bar where Foo has-many Bar's, class Foo { int ImportantNumber { get; set; } IEnumerable<Bar> Bars { get; set; } } class FooDTO { Foo Foo { get; set; } int BarCount { get; set; } } How can I efficiently sum up the number of Bars per Foo in a DTO using a single query, preferrably only with the Cr...

nHibernate criteria - how do I implement 'having count'

I have the following table structure and I want a turn the query into a NH criteria but I'm not sure how to incorporate the correct 'Projection', does anyone know how? And the query I want to turn into a Criteria: select ComponentId from Table_1 where [Name] = 'Contact' or [Name] = 'CurrencyPair' group by ComponentId having count(Ver...

PlaneProjection is not working well in silverlight

in silverlight project using name attribute in planeprojection gives Error 1 The type or namespace name 'PlaneProjection' could not be found (are you missing a using directive or an assembly reference?) code i used for that <Image Name="blabla.jpg" Height="200" Width="200" > <Image.Projection> <PlaneProjection Name="pp" /> ...

How can I recreate a SQL statement using NHibernate that has an inner select case?

I am trying to recreate something like the following SQL using NHibernate criteria: select Range, count(*) from ( select case when ent.ID between 'A' and 'N' then 'A-M' else 'Other' end as Range from Subject ) tbl group by tbl.Range I am able to create the inner select as follows: session.CreateCri...

If I'm projecting with linq and not using a range variable what is the proper syntax?

I have a query that sums and aggregates alot of data something like this: var anonType = from x in collection let Cars = collection.Where(c=>c.Code == "Cars") let Trucks = collection.Where(c=>c.Code == "Trucks") select new { Total = collection.Sum(v=>v.Amount), ...