ladybug-tools / spider

:spider_web: 3D interactive analysis in your browser mostly written around the Three.js JavaScript library
http://www.ladybug.tools/spider
44 stars 15 forks source link

rad viewer 10 ~ 2018-05-23 #118

Closed theo-armour closed 6 years ago

theo-armour commented 6 years ago

@ladybug-tools/spiders

image

full screen: Rad Viewer 4

Source code

theo-armour commented 6 years ago

@ladybug-tools/spiders

full screen: rad viewer 6

image

There are still a number of geometry primitives to be added. Once these are completed then materials will start to be added

image

mdengusiak commented 6 years ago

@theo-armour It get better with recognition london-office.rad... only few more to solve and we get perfect geometry in RAD :)

theo-armour commented 6 years ago

rad viewer 7

manhattan1

theo-armour commented 6 years ago

@ladybug-tools/spiders

rad viewer 8

image

image

mdengusiak commented 6 years ago

@theo-armour absolutely great!

mostaphaRoudsari commented 6 years ago

@theo-armour, This looks great! I can see that it fails to create the polygons with holes. That's a common practice in radiance that we should take care of it at some point.

theo-armour commented 6 years ago

@mostaphaRoudsari

I can see that it fails to create the polygons with holes.

Ha ha! This is computer graphics - a topic certainly full of holes.

Actually Radiance polygons do not support holes.

From: http://radsite.lbl.gov/radiance/refer/refman.pdf

Polygon A polygon is given by a list of three-dimensional vertices, which are ordered counter-clockwise as viewed from the front side (into the surface normal). The last vertex is automatically connected to the first. Holes are represented in polygons as interior vertices connected to the outer perimeter by coincident edges (seams).

In other words Radiance does not draw holes it just pretends to draw them. Radiance always triangulates the entire boundary. If, however, you draw your boundary very carefully it looks as if there is a hole.

For the most part Three.js Shapes can do this too. But the Shape geometry also supports actual holes. So it puts a condition on the drawing direction. It asks you to draw the Shape clockwise or counterclockwise.

Looking at the Radiance examples that I have, I see that with some geometries both the outside and the 'hole' are both drawn in the sane direction and other geometries even in the same example, the outside is drawn in one direction and the inside is drawn in the opposite direction.

Here is a graphic example of what I am seeing:

image

Here is an example of a wall where the lower surface with two openings is turned into multiple triangular faces and the upper surface with one opening is rendered as one polygon with a fake hole.

image

I think I am going to have a jolly good time trying to fix this one.

theo-armour commented 6 years ago

So it looks like the Radiance polygons where the false openings occur may be identified because they have ten or more vertices and at least two pairs of vertices are duplicates.

image

The interesting thing is that sometimes the Three.js shapes are two overlapping triangles and sometimes two overlapping rectangles and sometimes they are drawn correctly.

mostaphaRoudsari commented 6 years ago

@theo-armour, as usual you're making progress faster than what I can keep up with. :)

Yes. They will always have two pair of duplicate vertices. Here is a sample that shows how a polygon is structured:

exported_300

The interesting thing is that sometimes the Three.js shapes are two overlapping triangles and sometimes two overlapping rectangles and sometimes they are drawn correctly.

Not sure how you triangulate them but if you're picking every three vertices it is most likely because different polygons have different starting point.

Does THREE.js support creating planar mesh from a closed polygon?

bwelle commented 6 years ago

Actually sometime they will not have overlapping vertices. For example our rad files won’t. We will using antimatter to define polyloops.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Mostapha Sadeghipour Roudsari notifications@github.com Sent: Sunday, May 20, 2018 9:29:17 PM To: ladybug-tools/spider Cc: Welle, Benjamin; Team mention Subject: Re: [ladybug-tools/spider] rad viewer 8 (#118)

@theo-armourhttps://github.com/theo-armour, as usual you're making progress faster than what I can keep up with. :)

Yes. They will always have two pair of duplicate vertices. Here is a sample that shows how a polygon is structured:

[exported_300]https://user-images.githubusercontent.com/2915573/40280635-db49dd9c-5c24-11e8-8be3-a4d3f4d95c4a.gif

The interesting thing is that sometimes the Three.js shapes are two overlapping triangles and sometimes two overlapping rectangles and sometimes they are drawn correctly.

Not sure how you triangulate them but if you're picking every three vertices it is most likely because different polygons have different starting point.

Does THREE.js support creating planar mesh from a closed polygon?

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ladybug-tools/spider/issues/118#issuecomment-390492314, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AbaYGlmWg1ZsxnPCspm39GlYvrtgFB-Oks5t0ZLVgaJpZM4T5hCN.

mostaphaRoudsari commented 6 years ago

@bwelle , that is a different case which won't be part of this issue. In that case the parent surface will be a surface and openings with antimatter material will show up as surfaces which will overlap with the parent surface. We're discussing problematic polygons with holes that follow this definition:

Holes are represented in polygons as interior vertices connected to the outer perimeter by coincident edges (seams).

theo-armour commented 6 years ago

@mostaphaRoudsari

Thank you for the animated illustration of how holes are created in Radiance.

The interesting thing is that Radiance appears to be very flexible with polygons that start at a low vertex or a high vertex, with vertices that run clockwise or counter clockwise, with 'holes' where the vertices that run in the same direction as the outer vertices or in the opposite direction.

In other words, it appears to me, Radiance allows you to draw polygons anyway you want. Note: I'm only a few days into radiance. Anyway, this is wonderful.

I guess that one reason for this great flexibility may be that Radiance does not support actual topological holes in polygons. In any case, It's likely to take me a while to match this flexibility with Three.js but I do see resolution as being insurmountable.

Does THREE.js support creating planar mesh from a closed polygon?

Yes.

The issue is that although Three.js shapes may be positioned anywhere in 3D space, they must be created using only X and Y. Both the gbXML Viewer and Rad Viewer use functions that I write and maintain that take co-planer polygons in space, do all manner of things including - would you believe - 'conjugating their quaternions' to get them into flatland, and then do all manner of things to get the 2D shape into where it's meant to be back in 3D space.

I must say that I take great pride in this piece of code and it is the core and the mainstay of both viewers or a number of months. I have considered it a solid piece of linear algebra brevity and simplicity. Unfortunately for this code, I think, last night I found a way of writing the same thing even shorter, faster and smarter. So it goes.

The nice thing is that I came up with this while trying to deal with Greg Ward's polygons. I think I will be testing the code out while making the new viewer render the polygons more nicely,

theo-armour commented 6 years ago

@ladybug-tools/spiders

image

full screen: rad viewer 9

If the display of the geometry is not working for you, kindly send a link to a file that exhibits the issue.

@mdengusiak

What are program are you using to create your Rad files?

mdengusiak commented 6 years ago

@theo-armour this is ABSOLUTELY AMAZING!!!!! Viewer is now fully solved for my all projects!!! THANKS

All my files are from: Revit - gbXML - Honeybee - Radiance few old one link warwick / hour-13-0.rad where from Revit - Rhino - Radiance

I have now idea... do you think we could now see if some additional vertices can be removed and therefore surfaces simplified. Here we can see clearly that most of facade looks great only few parts causing issues? image

theo-armour commented 6 years ago

@mdengusiak

I'm happy you are happy

do you think we could now see if some additional vertices can be removed and therefore surfaces simplified

Why not just just press the 'toggle edges' button? Perhaps edges display off should be the default.

theo-armour commented 6 years ago

image Radiance RAD files with PTS data added as white-colored Three.js Sprites - all very work-in-progress

full screen: rad viewer 10

Working methods for associating PTS and RES data to the Three.js meshes is likely to be interesting. Just remember that Rome was not built in a day