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 Schmidt2196November 29, 2012 09:30AM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Philippe Hurbain662November 29, 2012 11:06AM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Rolf Osterthun638November 29, 2012 01:34PM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Tim Gould717November 29, 2012 11:58AM
Deadline Change Nils Schmidt597December 25, 2012 03:19AM
Re: Deadline Change Philippe Hurbain656December 25, 2012 06:30AM
First Alpha Screenshots Nils Schmidt743December 27, 2012 11:00AM
Additional Screenshots from the 3D Editor Nils Schmidt817December 29, 2012 01:39PM
Re: Additional Screenshots from the 3D Editor Philippe Hurbain659December 29, 2012 02:17PM
Re: Additional Screenshots from the 3D Editor Willy Tschager674January 19, 2013 12:50PM
Re: Additional Screenshots from the 3D Editor Michael Heidemann682January 20, 2013 12:32AM
Grid implementation done Nils Schmidt667January 08, 2013 03:47PM
Re: Grid implementation done Willy Tschager617January 09, 2013 12:03AM
Re: Grid implementation done - Note to Custom Colours & Shortkeys Nils Schmidt670January 09, 2013 04:26AM
Text Editor Impression Nils Schmidt805January 13, 2013 10:58AM
Re: Text Editor Impression Willy Tschager718January 13, 2013 01:00PM
Re: Text Editor Impression Nils Schmidt550March 24, 2014 10:54AM
[LDPartEditor] "SyncEdit" Feature Nils Schmidt506May 06, 2014 10:36AM
Startup dialog Nils Schmidt576January 18, 2013 07:25AM
Re: Startup dialog Philippe Hurbain650January 18, 2013 10:37AM
Syntax Highlighting Nils Schmidt582January 27, 2013 12:04PM
[Video] Text Editor with Drag & Drop Features Nils Schmidt666February 06, 2013 02:18PM
Re: [Video] Text Editor with Drag & Drop Features Philippe Hurbain726February 07, 2013 12:01AM
LDPartEditor on Ubuntu 14.04 LTS Nils Schmidt637March 09, 2014 08:14AM
Re: LDPartEditor on Ubuntu 14.04 LTS Tim Gould508March 09, 2014 02:18PM
Re: LDPartEditor on Ubuntu 14.04 LTS Willy Tschager520March 12, 2014 05:21AM
Test Environments Nils Schmidt425March 24, 2014 10:32AM
Another Text Editor Teaser Nils Schmidt481March 24, 2014 10:50AM
[LDPartEditor] First Appearance of 53588.dat :) Nils Schmidt545March 27, 2014 02:58PM
Re: [LDPartEditor] First Appearance of 53588.dat :) Santeri Piippo496March 27, 2014 03:13PM
Re: [LDPartEditor] First Appearance of 53588.dat :) Max Martin Richter513March 27, 2014 03:20PM
[LDPartEditor] Integrated Backface Culling Support Nils Schmidt629April 03, 2014 12:04PM
Re: [LDPartEditor] Integrated Backface Culling Support Philippe Hurbain759April 04, 2014 12:12AM
Re: [LDPartEditor] Integrated Backface Culling Support Willy Tschager703April 04, 2014 12:48AM
Re: [LDPartEditor] Integrated Backface Culling Support Michael Heidemann718April 04, 2014 11:57AM
[LDPartEditor] Optional Lines Nils Schmidt864April 04, 2014 02:38PM
Re: [LDPartEditor] Optional Lines Santeri Piippo680April 05, 2014 09:24AM
Re: [LDPartEditor] Optional Lines Nils Schmidt625April 07, 2014 02:58PM
[LDPartEditor] Improved Line Rendering Nils Schmidt738April 05, 2014 08:48AM
Re: [LDPartEditor] Improved Line Rendering Willy Tschager395April 15, 2014 04:31AM
[LDPartEditor] Vertex Manipulation Nils Schmidt597April 15, 2014 09:14AM
[LDPartEditor] Backface Culling, Random Colours, Vertices, Mesh Lines, Lighting... Nils Schmidt429April 15, 2014 12:30AM
[LDPartEditor] Edit different files in the 3D editor Nils Schmidt597April 15, 2014 11:33PM
[LDPartEditor] Vertex Selection I Nils Schmidt621April 17, 2014 03:22PM
[LDPartEditor] Anaglyph 3D + Transparency Nils Schmidt605April 21, 2014 07:47PM
Re: [LDPartEditor] Anaglyph 3D + Transparency Philippe Hurbain537April 22, 2014 12:03AM
Re: [LDPartEditor] Anaglyph 3D + Transparency Michael Heidemann455May 04, 2014 04:17AM
[LDPartEditor] Anaglyph Car Nils Schmidt493May 10, 2014 03:58PM
Re: [LDPartEditor] Anaglyph Car Michael Heidemann463May 17, 2014 11:51AM
[LDPartEditor] Integrated Text 2 Dat Converter Nils Schmidt606April 22, 2014 04:05PM
[LDPartEditor] VERTEX Meta Command Nils Schmidt535May 04, 2014 03:59AM
[LDPartEditor] Line and Face Selection I Nils Schmidt414May 11, 2014 05:31PM
Re: [LDPartEditor] First Alpha Version News Stephan Meisinger519May 18, 2014 01:42AM
Re: [LDPartEditor] Self-made Build? Nils Schmidt481May 20, 2014 05:12PM
[LDPartEditor] Transform Control / Manipulators Nils Schmidt479May 20, 2014 04:50PM
[LDPartEditor] First Example (Manipulator) Nils Schmidt378July 11, 2014 10:56AM
[LDPartEditor] More Manipulator Features Nils Schmidt364July 23, 2014 02:06PM
Re: [LDPartEditor] More Manipulator Features Philippe Hurbain434July 24, 2014 01:07AM
[LDPartEditor] Constructive Solid Geometry (CSG) - *UPDATED 2014-06 -24* Nils Schmidt601June 02, 2014 02:39AM
Re: [LDPartEditor] Constructive Solid Geometry (CSG) Philippe Hurbain432June 02, 2014 04:49AM
Re: [LDPartEditor] Constructive Solid Geometry (CSG) Magnus Forsberg521June 02, 2014 09:24AM
[LDPartEditor] CSG - A more complex example with DAT source code Attachments Nils Schmidt595June 25, 2014 08:07AM
[LDPartEditor] Hide Selection / Show All Nils Schmidt381June 28, 2014 11:28AM
[LDPartEditor] Colour Manipulation Nils Schmidt389July 15, 2014 11:22AM
[LDPartEditor] Texture Mapping: TEXMAP PLANAR Nils Schmidt487July 26, 2014 07:36PM
[LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Nils Schmidt432July 27, 2014 08:48AM
Re: [LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Roland Melkert402July 27, 2014 12:30PM
Re: [LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Travis Cobbs388July 27, 2014 10:40PM
[LDPartEditor] TEXMAP CYLINDRICAL is now working. Nils Schmidt403July 28, 2014 05:48AM
Re: [LDPartEditor] TEXMAP CYLINDRICAL is now working. Roland Melkert346July 28, 2014 12:50PM
Re: [LDPartEditor] TEXMAP CYLINDRICAL is now working. Travis Cobbs373July 28, 2014 04:18PM
[LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Nils Schmidt399July 28, 2014 09:26PM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Roland Melkert380July 29, 2014 11:05AM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Travis Cobbs388July 29, 2014 12:14PM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Roland Melkert392July 29, 2014 12:44PM
[LDPartEditor] Imperfect polar caps can't be solved. Nils Schmidt387July 30, 2014 09:11AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Tim Gould397July 30, 2014 12:10PM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Nils Schmidt411August 01, 2014 03:38AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Roland Melkert430August 01, 2014 08:47AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Ben Supnik443July 30, 2014 05:51PM
[LDPartEditor] Chequerboard-Texture Nils Schmidt399July 31, 2014 11:13AM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert373July 31, 2014 12:08PM
Re: [LDPartEditor] Chequerboard-Texture Philippe Hurbain367July 31, 2014 01:33PM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert384July 31, 2014 03:18PM
Re: [LDPartEditor] Chequerboard-Texture Philippe Hurbain396July 31, 2014 10:42PM
Re: [LDPartEditor] Chequerboard-Texture Attachments Ben Supnik347July 31, 2014 07:48PM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert381August 01, 2014 08:56AM
[LDPartEditor] Texture Mapping: Demo Video Nils Schmidt407July 31, 2014 04:44PM
Re: [LDPartEditor] Texture Mapping: Demo Video Roland Melkert395August 01, 2014 08:57AM
[LDPartEditor] Adding Objects to the Model Nils Schmidt393August 15, 2014 02:19PM
[LDPartEditor] Colour Picking (LDConfig + Direct Colours) Nils Schmidt394August 18, 2014 02:44PM
Re: [LDPartEditor] Colour Picking (LDConfig + Direct Colours) Willy Tschager424August 19, 2014 01:27PM
[LDPartEditor] Colour Picking with a Table Nils Schmidt374September 05, 2014 01:01PM
Re: [LDPartEditor] Colour Picking with a Table Willy Tschager354September 06, 2014 02:59AM
Re: [LDPartEditor] Colour Picking with a Table Nils Schmidt371September 06, 2014 04:08AM
Re: [LDPartEditor] Colour Picking with a Table Magnus Forsberg350September 06, 2014 05:48AM
[LDPartEditor] Arbitrary-precision arithmetic Nils Schmidt437August 26, 2014 09:24PM
[LDPartEditor] Colour Scheme for BFC / TEXMAP+BFC NOCLIP Nils Schmidt466September 04, 2014 12:54PM
[LDPartEditor] Integrated Edger2 Nils Schmidt394September 06, 2014 01:58PM
[LDPartEditor] Background Pictures Nils Schmidt365September 16, 2014 07:20AM
Re: [LDPartEditor] Background Pictures Philippe Hurbain393September 16, 2014 08:39AM
Re: [LDPartEditor] First Alpha Version News Max Martin Richter341September 16, 2014 09:18AM
[LDPartEditor] Auto-Copy all required or related files to unofficial library Nils Schmidt459September 18, 2014 12:33PM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Michael Heidemann398September 19, 2014 07:35AM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Nils Schmidt393September 19, 2014 05:58PM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Philippe Hurbain369September 20, 2014 12:44AM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Michael Heidemann708September 20, 2014 05:27AM



Sorry, only registered users may post in this forum.

Click here to login