Welcome! Log In Create A New Profile

Advanced
Re: [LDPartEditor] Optional Lines
avatarApril 07, 2014 02:58PM
Imagine an optional line with the four points A2, B2, C2 and D2.

1. Take these points and multiply them by their perspective and modelview matrix M.
As a result you'll get A, B, C and D in screen coordinates.

Matrix4f.transform(M, A2, A);
Matrix4f.transform(M, B2, B);
Matrix4f.transform(M, C2, C);
Matrix4f.transform(M, D2, D);

2. Calculate the line normal

N.x = A.y - B.y;
N.y = B.x - A.x;

3. Calculate the discriminant r by

r = Vector4f.dot(N, Vector4f.sub(C, A)) * Vector4f.dot(N, Vector4f.sub(D, A));

where Vector4f.dot() calculates the dot product of these two vectors and Vector4f.sub() the difference vector.

4. draw the line between A2 and B2 only if r > 0
SubjectAuthorViewsPosted
[LDPartEditor] First Alpha Version News (until 2014-09-19) Nils Schmidt1510November 29, 2012 09:30AM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Philippe Hurbain378November 29, 2012 11:06AM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Rolf Osterthun380November 29, 2012 01:34PM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Tim Gould382November 29, 2012 11:58AM
Deadline Change Nils Schmidt336December 25, 2012 03:19AM
Re: Deadline Change Philippe Hurbain375December 25, 2012 06:30AM
First Alpha Screenshots Nils Schmidt439December 27, 2012 11:00AM
Additional Screenshots from the 3D Editor Nils Schmidt425December 29, 2012 01:39PM
Re: Additional Screenshots from the 3D Editor Philippe Hurbain365December 29, 2012 02:17PM
Re: Additional Screenshots from the 3D Editor Willy Tschager357January 19, 2013 12:50PM
Re: Additional Screenshots from the 3D Editor Michael Heidemann383January 20, 2013 12:32AM
Grid implementation done Nils Schmidt395January 08, 2013 03:47PM
Re: Grid implementation done Willy Tschager343January 09, 2013 12:03AM
Re: Grid implementation done - Note to Custom Colours & Shortkeys Nils Schmidt340January 09, 2013 04:26AM
Text Editor Impression Nils Schmidt467January 13, 2013 10:58AM
Re: Text Editor Impression Willy Tschager390January 13, 2013 01:00PM
Re: Text Editor Impression Nils Schmidt205March 24, 2014 10:54AM
[LDPartEditor] "SyncEdit" Feature Nils Schmidt178May 06, 2014 10:36AM
Startup dialog Nils Schmidt318January 18, 2013 07:25AM
Re: Startup dialog Philippe Hurbain366January 18, 2013 10:37AM
Syntax Highlighting Nils Schmidt310January 27, 2013 12:04PM
[Video] Text Editor with Drag & Drop Features Nils Schmidt355February 06, 2013 02:18PM
Re: [Video] Text Editor with Drag & Drop Features Philippe Hurbain494February 07, 2013 12:01AM
LDPartEditor on Ubuntu 14.04 LTS Nils Schmidt281March 09, 2014 08:14AM
Re: LDPartEditor on Ubuntu 14.04 LTS Tim Gould180March 09, 2014 02:18PM
Re: LDPartEditor on Ubuntu 14.04 LTS Willy Tschager182March 12, 2014 05:21AM
Test Environments Nils Schmidt158March 24, 2014 10:32AM
Another Text Editor Teaser Nils Schmidt177March 24, 2014 10:50AM
[LDPartEditor] First Appearance of 53588.dat :) Nils Schmidt213March 27, 2014 02:58PM
Re: [LDPartEditor] First Appearance of 53588.dat :) Santeri Piippo169March 27, 2014 03:13PM
Re: [LDPartEditor] First Appearance of 53588.dat :) Max Martin Richter202March 27, 2014 03:20PM
[LDPartEditor] Integrated Backface Culling Support Nils Schmidt248April 03, 2014 12:04PM
Re: [LDPartEditor] Integrated Backface Culling Support Philippe Hurbain451April 04, 2014 12:12AM
Re: [LDPartEditor] Integrated Backface Culling Support Willy Tschager393April 04, 2014 12:48AM
Re: [LDPartEditor] Integrated Backface Culling Support Michael Heidemann414April 04, 2014 11:57AM
[LDPartEditor] Optional Lines Nils Schmidt500April 04, 2014 02:38PM
Re: [LDPartEditor] Optional Lines Santeri Piippo401April 05, 2014 09:24AM
Re: [LDPartEditor] Optional Lines Nils Schmidt276April 07, 2014 02:58PM
[LDPartEditor] Improved Line Rendering Nils Schmidt408April 05, 2014 08:48AM
Re: [LDPartEditor] Improved Line Rendering Willy Tschager107April 15, 2014 04:31AM
[LDPartEditor] Vertex Manipulation Nils Schmidt190April 15, 2014 09:14AM
[LDPartEditor] Backface Culling, Random Colours, Vertices, Mesh Lines, Lighting... Nils Schmidt143April 15, 2014 12:30AM
[LDPartEditor] Edit different files in the 3D editor Nils Schmidt259April 15, 2014 11:33PM
[LDPartEditor] Vertex Selection I Nils Schmidt235April 17, 2014 03:22PM
[LDPartEditor] Anaglyph 3D + Transparency Nils Schmidt233April 21, 2014 07:47PM
Re: [LDPartEditor] Anaglyph 3D + Transparency Philippe Hurbain211April 22, 2014 12:03AM
Re: [LDPartEditor] Anaglyph 3D + Transparency Michael Heidemann164May 04, 2014 04:17AM
[LDPartEditor] Anaglyph Car Nils Schmidt145May 10, 2014 03:58PM
Re: [LDPartEditor] Anaglyph Car Michael Heidemann149May 17, 2014 11:51AM
[LDPartEditor] Integrated Text 2 Dat Converter Nils Schmidt261April 22, 2014 04:05PM
[LDPartEditor] VERTEX Meta Command Nils Schmidt139May 04, 2014 03:59AM
[LDPartEditor] Line and Face Selection I Nils Schmidt151May 11, 2014 05:31PM
Re: [LDPartEditor] First Alpha Version News Stephan Meisinger162May 18, 2014 01:42AM
Re: [LDPartEditor] Self-made Build? Nils Schmidt133May 20, 2014 05:12PM
[LDPartEditor] Transform Control / Manipulators Nils Schmidt130May 20, 2014 04:50PM
[LDPartEditor] First Example (Manipulator) Nils Schmidt111July 11, 2014 10:56AM
[LDPartEditor] More Manipulator Features Nils Schmidt98July 23, 2014 02:06PM
Re: [LDPartEditor] More Manipulator Features Philippe Hurbain102July 24, 2014 01:07AM
[LDPartEditor] Constructive Solid Geometry (CSG) - *UPDATED 2014-06 -24* Nils Schmidt184June 02, 2014 02:39AM
Re: [LDPartEditor] Constructive Solid Geometry (CSG) Philippe Hurbain135June 02, 2014 04:49AM
Re: [LDPartEditor] Constructive Solid Geometry (CSG) Magnus Forsberg166June 02, 2014 09:24AM
[LDPartEditor] CSG - A more complex example with DAT source code Attachments Nils Schmidt126June 25, 2014 08:07AM
[LDPartEditor] Hide Selection / Show All Nils Schmidt105June 28, 2014 11:28AM
[LDPartEditor] Colour Manipulation Nils Schmidt84July 15, 2014 11:22AM
[LDPartEditor] Texture Mapping: TEXMAP PLANAR Nils Schmidt125July 26, 2014 07:36PM
[LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Nils Schmidt101July 27, 2014 08:48AM
Re: [LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Roland Melkert106July 27, 2014 12:30PM
Re: [LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Travis Cobbs102July 27, 2014 10:40PM
[LDPartEditor] TEXMAP CYLINDRICAL is now working. Nils Schmidt116July 28, 2014 05:48AM
Re: [LDPartEditor] TEXMAP CYLINDRICAL is now working. Roland Melkert78July 28, 2014 12:50PM
Re: [LDPartEditor] TEXMAP CYLINDRICAL is now working. Travis Cobbs97July 28, 2014 04:18PM
[LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Nils Schmidt107July 28, 2014 09:26PM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Roland Melkert97July 29, 2014 11:05AM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Travis Cobbs96July 29, 2014 12:14PM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Roland Melkert91July 29, 2014 12:44PM
[LDPartEditor] Imperfect polar caps can't be solved. Nils Schmidt108July 30, 2014 09:11AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Tim Gould105July 30, 2014 12:10PM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Nils Schmidt86August 01, 2014 03:38AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Roland Melkert99August 01, 2014 08:47AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Ben Supnik115July 30, 2014 05:51PM
[LDPartEditor] Chequerboard-Texture Nils Schmidt103July 31, 2014 11:13AM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert83July 31, 2014 12:08PM
Re: [LDPartEditor] Chequerboard-Texture Philippe Hurbain81July 31, 2014 01:33PM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert107July 31, 2014 03:18PM
Re: [LDPartEditor] Chequerboard-Texture Philippe Hurbain81July 31, 2014 10:42PM
Re: [LDPartEditor] Chequerboard-Texture Attachments Ben Supnik80July 31, 2014 07:48PM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert95August 01, 2014 08:56AM
[LDPartEditor] Texture Mapping: Demo Video Nils Schmidt118July 31, 2014 04:44PM
Re: [LDPartEditor] Texture Mapping: Demo Video Roland Melkert104August 01, 2014 08:57AM
[LDPartEditor] Adding Objects to the Model Nils Schmidt85August 15, 2014 02:19PM
[LDPartEditor] Colour Picking (LDConfig + Direct Colours) Nils Schmidt105August 18, 2014 02:44PM
Re: [LDPartEditor] Colour Picking (LDConfig + Direct Colours) Willy Tschager106August 19, 2014 01:27PM
[LDPartEditor] Colour Picking with a Table Nils Schmidt76September 05, 2014 01:01PM
Re: [LDPartEditor] Colour Picking with a Table Willy Tschager64September 06, 2014 02:59AM
Re: [LDPartEditor] Colour Picking with a Table Nils Schmidt51September 06, 2014 04:08AM
Re: [LDPartEditor] Colour Picking with a Table Magnus Forsberg55September 06, 2014 05:48AM
[LDPartEditor] Arbitrary-precision arithmetic Nils Schmidt119August 26, 2014 09:24PM
[LDPartEditor] Colour Scheme for BFC / TEXMAP+BFC NOCLIP Nils Schmidt101September 04, 2014 12:54PM
[LDPartEditor] Integrated Edger2 Nils Schmidt85September 06, 2014 01:58PM
[LDPartEditor] Background Pictures Nils Schmidt76September 16, 2014 07:20AM
Re: [LDPartEditor] Background Pictures Philippe Hurbain50September 16, 2014 08:39AM
Re: [LDPartEditor] First Alpha Version News Max Martin Richter70September 16, 2014 09:18AM
[LDPartEditor] Auto-Copy all required or related files to unofficial library Nils Schmidt87September 18, 2014 12:33PM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Michael Heidemann87September 19, 2014 07:35AM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Nils Schmidt84September 19, 2014 05:58PM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Philippe Hurbain71September 20, 2014 12:44AM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Michael Heidemann91September 20, 2014 05:27AM



Sorry, only registered users may post in this forum.

Click here to login