Re: Libraries for Model Loading
On Thursday, 18 July 2024 at 14:02:09 UTC, Ruby The Roobster wrote: Is there a good package available that can load models, Wavefront .obj files in particular? I tried to use the existing bindings to old versions of Assimp, but I could not get Assimp itself to build on my machine. Thanks in advance. I would bind to Assimp using [ImportC](https://dlang.org/spec/importc.html).
Re: Packaging and Distributing Dlang Applications with GtkD Dependency?
On Saturday, 28 September 2019 at 16:20:03 UTC, snow jhon wrote: On Thursday, 26 September 2019 at 10:07:34 UTC, bioinfornatics wrote: [...] To be more precise, gtkd is a wrapper for GTK. Gtkd is not interesting in this context, but the dependency on gtk. On windows you have the possibility to either publish your application with GTK dlls or to run gtk setup routine as part of your application setup routine or just say in your readme that the customer needs to run GTK setup on there own. see: https://bluestacks.vip/ , https://kodi.software/ & https://luckypatcher.pro/
Re: Looking for a Simple Doubly Linked List Implementation
On Saturday, 28 September 2019 at 16:21:10 UTC, snow jhon wrote: On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote: [...] Below is a simple doubly linked list with Garbage Collected memory. It's not performant or complete by any means, just a minimal example in D like you wanted. You probably also want methods for removing nodes or inserting in the middle (else why don't you use an array?), I think you can think of an implementation for those yourself (or look them up, there should be plenty examples online). https://tutuapp.uno/ , https://9apps.ooo/ , https://showbox.kim/
Re: Packaging and Distributing Dlang Applications with GtkD Dependency?
On Thursday, 26 September 2019 at 10:07:34 UTC, bioinfornatics wrote: On Wednesday, 25 September 2019 at 17:03:51 UTC, Ron Tarrant wrote: On Wednesday, 25 September 2019 at 13:52:48 UTC, bioinfornatics wrote: I think I misunderstood your need but are lo looking for dub tool with its repository https://code.dlang.org/ I don't think so, but I could be wrong. I tried reading up on dub, but got lost in the docs, so I really don't understand what all it can do. dub is more or less like pip from python, npm from javascript and so on ... The code source is here: https://github.com/dlang/dub you can open an issue there or open a thread about how to write package file for dub doc: https://dub.pm/package-format-json) have a nice day To be more precise, gtkd is a wrapper for GTK. Gtkd is not interesting in this context, but the dependency on gtk. On windows you have the possibility to either publish your application with GTK dlls or to run gtk setup routine as part of your application setup routine or just say in your readme that the customer needs to run GTK setup on there own.
Re: Looking for a Simple Doubly Linked List Implementation
On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote: On Saturday, 21 September 2019 at 08:34:09 UTC, Ron Tarrant wrote: Thanks, Dennis. Not performant... It doesn't work? I was hoping for a complete, working example, but maybe this'll help. Bad word choice (it appears it's debatable whether 'performant' even is a word), I meant it was a simple implementation not optimized for speed / memory efficiency. Making it 'complete' is a bit hard since I can think of tens of methods and operator overloads you could use, but if I include them all it's no longer minimal and it just becomes std.container.dlist. Does a doubly-linked list always have to be done with structs? Can it be classes instead? My example originally included classes actually. It was mostly the same, except that Node!T* was just Node!T. The only problem was with const: ``` size_t length() const { size_t result = 0; for(auto a = head; a !is null; a = a.next) result++; return result; } ``` Since I marked the method as const, `auto a = head` got the type const(Node!T) and `a = a.next` no longer compiled. With structs you can declare a const(Node!T)* (mutable pointer to const node), but I don't know if I can declare a mutable reference to a const class, so I switched to structs. Below is a simple doubly linked list with Garbage Collected memory. It's not performant or complete by any means, just a minimal example in D like you wanted. You probably also want methods for removing nodes or inserting in the middle (else why don't you use an array?), I think you can think of an implementation for those yourself (or look them up, there should be plenty examples online).
Re: sort error
On Saturday, 29 June 2013 at 14:20:05 UTC, Ali Çehreli wrote: On 06/29/2013 05:46 AM, snow wrote: > On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: >> Your opCmp does not provide a complete ordering of objects: >> >> int opCmp(ref const Vector3D vec) { >> if (this.x > vec.x && this.y > vec.y && this.z > vec.z) >> return 1; >> >> if (this.x < vec.x && this.y < vec.y && this.z < vec.z) >> return -1; >> >> return 0; >> } >> >> According to that function, the following two values are neither less >> than nor greater than the other: >> >> // passes: >> assert(!(Vector3D(1, 2, 3) < Vector3D(2, 1, 3)) && >>!(Vector3D(1, 2, 3) > Vector3D(2, 1, 3))); >> >> Ali > > I tried this now: > int opCmp(ref const Vector3D vec) { > if (this.x > vec.x && this.y > vec.y && this.z > vec.z) > return 1; > return -1; > } > this should be a total ordering, Unfortunately, no. opCmp must return 0 when the values are considered equal. > because a Vector is always greater or smaller, than another, > but I still get the same exception. Not knowing whether it applies to your case, the following is one almost correct way of writing opCmp: int opCmp(ref const Vector3D vec) { return cast(int)(x != vec.x ? x - vec.x : (y != vec.y ? y - vec.y : z - vec.z)); } The reason I said "almost" is due to the usual floating point equality comparison warnings. Values that are supposed to be equal may not compare equal due to accumulated earlier floating point calculation errors. Ali Thats a cool way, thanks. But the exception is still coming. Both solutions throw -1,0 or 1. So my first solution should work, too. Sure that the exception is coming, because of the compare function?
Re: sort error
On Friday, 28 June 2013 at 17:07:22 UTC, Ali Çehreli wrote: On 06/28/2013 07:00 AM, snow wrote:> Hello there, > Ive got the following code > > http://dpaste.dzfl.pl/e391a268 > > This code throws me a "Range Exception" in Algorithm.d. > > If I use a lower number of random vectors, like 100, the code > terminates. Also, if I delete the template instruction like this : > > sort(individuals); > > I also don't get an exception. Yes, what is thrown is an Error. (Error and Exception are different hierarchies under Throwable.) > Does anybody know, why this is the case? Your opCmp does not provide a complete ordering of objects: int opCmp(ref const Vector3D vec) { if (this.x > vec.x && this.y > vec.y && this.z > vec.z) return 1; if (this.x < vec.x && this.y < vec.y && this.z < vec.z) return -1; return 0; } According to that function, the following two values are neither less than nor greater than the other: // passes: assert(!(Vector3D(1, 2, 3) < Vector3D(2, 1, 3)) && !(Vector3D(1, 2, 3) > Vector3D(2, 1, 3))); Ali I tried this now: int opCmp(ref const Vector3D vec) { if (this.x > vec.x && this.y > vec.y && this.z > vec.z) return 1; return -1; } this should be a total ordering, because a Vector is always greater or smaller, than another, but I still get the same exception.
sort error
Hello there, Ive got the following code http://dpaste.dzfl.pl/e391a268 This code throws me a "Range Exception" in Algorithm.d. If I use a lower number of random vectors, like 100, the code terminates. Also, if I delete the template instruction like this : sort(individuals); I also don't get an exception. Does anybody know, why this is the case?
decimal to binary
Hello, I searched a lot in the docs and search, but couldn't find anything so far. Is there a funtion, which converts my decimal number into a binary?
Re: D under Linux Mint
Thank you very much. I wrote the real paths into the dmd.conf and there was really a copy of dmd.conf in the usr/local/bin. I deleted everything there, except the dmd, dumpobj and the obj2asm and now its working.
D under Linux Mint
Hello, Ive tried to install D under Linux and followed the steps described on . this page http://dlang.org/dmd-linux.html . I checked all folders after every step and everything is where it should be. In the secound step I did both, adding dmd to the PATH and copied the executables into the lib folder. If I type dmd into the console, I get back all infos about D, so this is already working. But if I try to run a simple Hello world program like this: import std.stdio; void main() { writeln("Hallo Welt"); } I get the following error: object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /usr/local/bin/../../src/phobos import path[1] = /usr/local/bin/../../src/druntime/import My DMD folder is in the home directory and the dmd.config contains this: [Environment] DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L-L%@P%/../lib32 -L--no-warn-search-mismatch -L--export-dynamic I already tried to compile the program with geany and the console. In the console i trid to compile it as: dmd hello.d and dmd -c hello.d. But everywhere I get the same errors