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 Schmidt1550November 29, 2012 09:30AM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Philippe Hurbain391November 29, 2012 11:06AM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Rolf Osterthun388November 29, 2012 01:34PM
Re: [LDPartEditor] First Alpha Version as a Christmas Gift Tim Gould399November 29, 2012 11:58AM
Deadline Change Nils Schmidt352December 25, 2012 03:19AM
Re: Deadline Change Philippe Hurbain387December 25, 2012 06:30AM
First Alpha Screenshots Nils Schmidt457December 27, 2012 11:00AM
Additional Screenshots from the 3D Editor Nils Schmidt440December 29, 2012 01:39PM
Re: Additional Screenshots from the 3D Editor Philippe Hurbain381December 29, 2012 02:17PM
Re: Additional Screenshots from the 3D Editor Willy Tschager375January 19, 2013 12:50PM
Re: Additional Screenshots from the 3D Editor Michael Heidemann402January 20, 2013 12:32AM
Grid implementation done Nils Schmidt412January 08, 2013 03:47PM
Re: Grid implementation done Willy Tschager363January 09, 2013 12:03AM
Re: Grid implementation done - Note to Custom Colours & Shortkeys Nils Schmidt357January 09, 2013 04:26AM
Text Editor Impression Nils Schmidt486January 13, 2013 10:58AM
Re: Text Editor Impression Willy Tschager410January 13, 2013 01:00PM
Re: Text Editor Impression Nils Schmidt234March 24, 2014 10:54AM
[LDPartEditor] "SyncEdit" Feature Nils Schmidt200May 06, 2014 10:36AM
Startup dialog Nils Schmidt335January 18, 2013 07:25AM
Re: Startup dialog Philippe Hurbain385January 18, 2013 10:37AM
Syntax Highlighting Nils Schmidt326January 27, 2013 12:04PM
[Video] Text Editor with Drag & Drop Features Nils Schmidt369February 06, 2013 02:18PM
Re: [Video] Text Editor with Drag & Drop Features Philippe Hurbain504February 07, 2013 12:01AM
LDPartEditor on Ubuntu 14.04 LTS Nils Schmidt298March 09, 2014 08:14AM
Re: LDPartEditor on Ubuntu 14.04 LTS Tim Gould191March 09, 2014 02:18PM
Re: LDPartEditor on Ubuntu 14.04 LTS Willy Tschager204March 12, 2014 05:21AM
Test Environments Nils Schmidt171March 24, 2014 10:32AM
Another Text Editor Teaser Nils Schmidt184March 24, 2014 10:50AM
[LDPartEditor] First Appearance of 53588.dat :) Nils Schmidt234March 27, 2014 02:58PM
Re: [LDPartEditor] First Appearance of 53588.dat :) Santeri Piippo187March 27, 2014 03:13PM
Re: [LDPartEditor] First Appearance of 53588.dat :) Max Martin Richter216March 27, 2014 03:20PM
[LDPartEditor] Integrated Backface Culling Support Nils Schmidt273April 03, 2014 12:04PM
Re: [LDPartEditor] Integrated Backface Culling Support Philippe Hurbain460April 04, 2014 12:12AM
Re: [LDPartEditor] Integrated Backface Culling Support Willy Tschager409April 04, 2014 12:48AM
Re: [LDPartEditor] Integrated Backface Culling Support Michael Heidemann429April 04, 2014 11:57AM
[LDPartEditor] Optional Lines Nils Schmidt525April 04, 2014 02:38PM
Re: [LDPartEditor] Optional Lines Santeri Piippo414April 05, 2014 09:24AM
Re: [LDPartEditor] Optional Lines Nils Schmidt289April 07, 2014 02:58PM
[LDPartEditor] Improved Line Rendering Nils Schmidt421April 05, 2014 08:48AM
Re: [LDPartEditor] Improved Line Rendering Willy Tschager123April 15, 2014 04:31AM
[LDPartEditor] Vertex Manipulation Nils Schmidt217April 15, 2014 09:14AM
[LDPartEditor] Backface Culling, Random Colours, Vertices, Mesh Lines, Lighting... Nils Schmidt172April 15, 2014 12:30AM
[LDPartEditor] Edit different files in the 3D editor Nils Schmidt278April 15, 2014 11:33PM
[LDPartEditor] Vertex Selection I Nils Schmidt271April 17, 2014 03:22PM
[LDPartEditor] Anaglyph 3D + Transparency Nils Schmidt268April 21, 2014 07:47PM
Re: [LDPartEditor] Anaglyph 3D + Transparency Philippe Hurbain228April 22, 2014 12:03AM
Re: [LDPartEditor] Anaglyph 3D + Transparency Michael Heidemann184May 04, 2014 04:17AM
[LDPartEditor] Anaglyph Car Nils Schmidt169May 10, 2014 03:58PM
Re: [LDPartEditor] Anaglyph Car Michael Heidemann162May 17, 2014 11:51AM
[LDPartEditor] Integrated Text 2 Dat Converter Nils Schmidt294April 22, 2014 04:05PM
[LDPartEditor] VERTEX Meta Command Nils Schmidt158May 04, 2014 03:59AM
[LDPartEditor] Line and Face Selection I Nils Schmidt170May 11, 2014 05:31PM
Re: [LDPartEditor] First Alpha Version News Stephan Meisinger174May 18, 2014 01:42AM
Re: [LDPartEditor] Self-made Build? Nils Schmidt147May 20, 2014 05:12PM
[LDPartEditor] Transform Control / Manipulators Nils Schmidt142May 20, 2014 04:50PM
[LDPartEditor] First Example (Manipulator) Nils Schmidt129July 11, 2014 10:56AM
[LDPartEditor] More Manipulator Features Nils Schmidt114July 23, 2014 02:06PM
Re: [LDPartEditor] More Manipulator Features Philippe Hurbain120July 24, 2014 01:07AM
[LDPartEditor] Constructive Solid Geometry (CSG) - *UPDATED 2014-06 -24* Nils Schmidt212June 02, 2014 02:39AM
Re: [LDPartEditor] Constructive Solid Geometry (CSG) Philippe Hurbain147June 02, 2014 04:49AM
Re: [LDPartEditor] Constructive Solid Geometry (CSG) Magnus Forsberg191June 02, 2014 09:24AM
[LDPartEditor] CSG - A more complex example with DAT source code Attachments Nils Schmidt143June 25, 2014 08:07AM
[LDPartEditor] Hide Selection / Show All Nils Schmidt115June 28, 2014 11:28AM
[LDPartEditor] Colour Manipulation Nils Schmidt101July 15, 2014 11:22AM
[LDPartEditor] Texture Mapping: TEXMAP PLANAR Nils Schmidt142July 26, 2014 07:36PM
[LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Nils Schmidt131July 27, 2014 08:48AM
Re: [LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Roland Melkert120July 27, 2014 12:30PM
Re: [LDPartEditor] TEXMAP PLANAR / CYLINDRICAL / SPHERICAL (I need help) Travis Cobbs117July 27, 2014 10:40PM
[LDPartEditor] TEXMAP CYLINDRICAL is now working. Nils Schmidt133July 28, 2014 05:48AM
Re: [LDPartEditor] TEXMAP CYLINDRICAL is now working. Roland Melkert92July 28, 2014 12:50PM
Re: [LDPartEditor] TEXMAP CYLINDRICAL is now working. Travis Cobbs106July 28, 2014 04:18PM
[LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Nils Schmidt125July 28, 2014 09:26PM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Roland Melkert108July 29, 2014 11:05AM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Travis Cobbs108July 29, 2014 12:14PM
Re: [LDPartEditor] TEXMAP SPHERICAL (with imperfect polar caps) Roland Melkert108July 29, 2014 12:44PM
[LDPartEditor] Imperfect polar caps can't be solved. Nils Schmidt120July 30, 2014 09:11AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Tim Gould123July 30, 2014 12:10PM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Nils Schmidt98August 01, 2014 03:38AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Roland Melkert126August 01, 2014 08:47AM
Re: [LDPartEditor] Imperfect polar caps can't be solved. Ben Supnik137July 30, 2014 05:51PM
[LDPartEditor] Chequerboard-Texture Nils Schmidt124July 31, 2014 11:13AM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert101July 31, 2014 12:08PM
Re: [LDPartEditor] Chequerboard-Texture Philippe Hurbain94July 31, 2014 01:33PM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert131July 31, 2014 03:18PM
Re: [LDPartEditor] Chequerboard-Texture Philippe Hurbain96July 31, 2014 10:42PM
Re: [LDPartEditor] Chequerboard-Texture Attachments Ben Supnik90July 31, 2014 07:48PM
Re: [LDPartEditor] Chequerboard-Texture Roland Melkert119August 01, 2014 08:56AM
[LDPartEditor] Texture Mapping: Demo Video Nils Schmidt136July 31, 2014 04:44PM
Re: [LDPartEditor] Texture Mapping: Demo Video Roland Melkert113August 01, 2014 08:57AM
[LDPartEditor] Adding Objects to the Model Nils Schmidt95August 15, 2014 02:19PM
[LDPartEditor] Colour Picking (LDConfig + Direct Colours) Nils Schmidt120August 18, 2014 02:44PM
Re: [LDPartEditor] Colour Picking (LDConfig + Direct Colours) Willy Tschager116August 19, 2014 01:27PM
[LDPartEditor] Colour Picking with a Table Nils Schmidt91September 05, 2014 01:01PM
Re: [LDPartEditor] Colour Picking with a Table Willy Tschager81September 06, 2014 02:59AM
Re: [LDPartEditor] Colour Picking with a Table Nils Schmidt69September 06, 2014 04:08AM
Re: [LDPartEditor] Colour Picking with a Table Magnus Forsberg68September 06, 2014 05:48AM
[LDPartEditor] Arbitrary-precision arithmetic Nils Schmidt131August 26, 2014 09:24PM
[LDPartEditor] Colour Scheme for BFC / TEXMAP+BFC NOCLIP Nils Schmidt112September 04, 2014 12:54PM
[LDPartEditor] Integrated Edger2 Nils Schmidt102September 06, 2014 01:58PM
[LDPartEditor] Background Pictures Nils Schmidt95September 16, 2014 07:20AM
Re: [LDPartEditor] Background Pictures Philippe Hurbain62September 16, 2014 08:39AM
Re: [LDPartEditor] First Alpha Version News Max Martin Richter84September 16, 2014 09:18AM
[LDPartEditor] Auto-Copy all required or related files to unofficial library Nils Schmidt127September 18, 2014 12:33PM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Michael Heidemann122September 19, 2014 07:35AM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Nils Schmidt110September 19, 2014 05:58PM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Philippe Hurbain87September 20, 2014 12:44AM
Re: [LDPartEditor] Auto-Copy all required or related files to unofficial library Michael Heidemann137September 20, 2014 05:27AM



Sorry, only registered users may post in this forum.

Click here to login