Mushrooms - P. cubensis & Cannabis
I was told that my first mushroom experience would be special. All of the stories of experience in the world could not have prepared me for the truth of what would happen, however. It was the one year anniversary of my boyfriend and myself. I had begun smoking cannabis regularly that year thanks to him and enjoyed it very much. It being the only drug I had tried, Josh suggested to me that I try mushrooms. He enjoyed them very much and though I was nervous about trying something psychedelic, I was also excited.
I spoke to my father about it (being an experienced drug user from his youth I valued his opinion), and he suggested a method of consumption that he and his friends had often used. They would mix their mushrooms with orange juice in a blender then take the resulting slush as shots. When I told my boyfriend this, he thought it was a great idea. We borrowed a blender from someone and Josh brought back a quarter ounce of shrooms from Schwagstock, a local hippie festival which at that point I hadn’t yet attended. The night we planned to do the mushrooms we were at his apartment. Josh had made me spaghetti to eat but I was too nervous and, not realizing the effects of an empty stomach, didn’t eat much. Josh and I had smoked a few bowls of cannabis to loosen me up and prepared one for the duration of the trip. We never got to that bowl. Josh, who had tripped several times before that, dumped the entire bag into 4 shots worth of orange juice, 2 for each of us.
When I picked up the first shot and put it to my lips, I was washed in anxiety and nervousness but pushed through and took the shot anyway. It tasted awful, but I had known it would. I took the second shot, Josh seemingly having long since downed his. I went to sit down in the living room. After 10 minutes, I mentioned to Josh that the colors on South Park seemed to be brighter and vibrating to which he responded I was just nervous and wanting them to. He said there was no way I could be feeling them yet, that I had about an hour yet before they really kicked in. Five minutes later, a huge uncontrollable or erasable smile cemented to my face and I noticed that a sculpture of a dragon that Josh had sitting next to the TV was writhing. Josh immediately conceded that he was most definitely feeling it already and that those oj shots had really made the difference. At that point, we had no clue just how much of a difference.
Some events that took place in the next 20 minutes lack chronology and have blurry spots, but I remember enough. Somehow I decided that sitting up in a chair was too much stress so I lay down in the living room floor after removing all my clothes claiming that it was way too hot in his apartment despite the AC blaring. I looked up at the ceiling and was shocked by its absolute beauty. It seemed to be made out of thousands of iridescent bubbles shimmering and shifting in circles. I invited Josh to see and he did, just as amazed as I was. Josh sat up next to me still on the ground and looked around his apartment with sudden awe. His face was masked with what I can now recognize as the detachment/connectedness of tripping. As I watched his features shift with frightening rapidity between expressions varying from elated to confused to awed, I began to feel extremely overheated. My breathing sped and I was suddenly awash in everything all at once. It was too much. Far far too much.
The rooms colors began shifting uncontrollably and when I looked back at Josh’s face, it was contorted into something red and frightening. I rolled to my side and curled into the fetal position as the muscles in my body tightened without release while shivering like I was in the throes of an awful fever. Closing my eyes, my breath was sucked from my lungs as I was projected at light speed through what I can only describe as infinite dark matrices. I was surrounded by and pushed through what seemed to be the rods and balls of 3d molecule models. It felt as if my entire body was being thrown through space and I couldn’t stop the feelings within me or images before me. Opening my eyes after what seemed an eternity, I rolled to face Josh and whimpered to him that it was too much and wouldn’t stop. He looked at me dazedly, lost in a trip as strong as mine, but not so dark. He said to calm down and not think too much about it to which I replied that that was of course impossible.
Every time I looked up at him, things got worse as all I could think was “What if something happened? He couldn’t help me at all.” I was preoccupied with the fact that he was messed up and that frightened me very much. His erratic facial expressions bothered me. He suddenly began pouring out profound and deep philosophic thoughts which seemed to hit me one by one with enough weight to make me beg him to stop. I wouldn’t allow myself to think about the things he was saying; it seemed that doing so would send me into an even deeper state of consiousness, something I wanted to avoid at all costs. I thought again and again “What have I done?” All horrible events which could possibly happen occurred to me and worsened my state by the minute. I felt as if there was evil inside of me. I became convinced that I could feel the dark energy that surrounded us both and it was absolutely terrifying.
I tried to focus on the passing of time, attempting to remain focused on the knowledge that I was just tripping and that must logically come to an end sooner or later. I went to the bed and closed my eyes again and was blinded by the colors that flashed before my eyes. It seemed that there was a subway train flying through my eyes sending blinding lights zooming past my vision. I lay there with my body and jaw clenched, sweating profusely as I was completely overwhelmed by the very existence of the universe. I was too connected and couldn’t take it. Finally after what I was ABSOLUTELY POSITIVE had been at least 2 or 3 hours, I opened my eyes hoping to be comforted by the knowledge that it couldn’t possibly last much longer only to discover to my horror that only a little over 15 minutes had passed.
With the knowledge that the mushrooms weren’t probably even fully diffused into my system yet, I went to the bathroom and forced myself to violently throw up. Even as I leaned against the bathroom wall having just finished, I felt somewhat better. I returned to the bedroom and lay back down next to Josh. As Josh continued to be completely detached and speak of philosophy, I couldn’t shake the darkness that seemed to surround me. I felt with all my being that he needed to care about me and for me, something he simply couldn’t do in his current state. Josh, who as genuinely concerned for me to the best of his abilities, made the difficult decision to give up the best trip of his life and went to throw up as well so he could care for me. After doing so, he returned to bed and pulled me to curl up against him. We both cried and held each other and prayed and promised that we would never do mushrooms again.
Suddenly, it felt as if out of nowhere a cool breeze washed over me and it was over. The evil as gone and everything glowed with purity and beauty. I suddenly took a deep breath and discovered that I felt connected with everything still, but I could take it now.  I was touched by what I described at the time as complete and perfect knowledge of the universe. Though I can’t remember what they were now, I too spouted deep philosophic realizations for the next 10 or 15 minutes, though it seemed like much longer.
At much the same time for each of us, our trip ended completely. Despite what had been possibly the most horrible and traumatizing experience of my life, I was left with a feeling of sadness at having lost the feeling. Josh, too, was very upset that he had thrown up. The last 15 minutes had somehow made me understand that what I had gone through may have been worth it. It made me wonder if such a deep realization of the universe had been granted me only through the price of seeing its evil as well. Though we regretted it in the moment, we fully understood that what we had done had been necessary considering what I had been going through.
Since that time, Josh has done mushrooms many times though he has never been able to find a trip as strong or profound as the one we experienced that night.  I have come to the conclusion that my mindset is too damaged for mushrooms and the anxiety surrounding what happened would be enough to cause myself to repeat the experience. I still look back at the final moments of my trip as some of the most amazing and tangible I have ever experienced. I believe that some people search their lives for what I found, and I don’t feel that I would be able to achieve it again if I tried. While I would love to repeat that feeling, something in me tells me that that was it for me.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


The Content You Are Looking For Has Not Been Found. Use The Navigation Bar On The Top To Get Back To Where You Were.


News story
The ‘100 in 100 apprenticeship campaign’ will see MPs securing apprenticeship pledges from businesses in their constituencies.
The Prime Minister’s Apprenticeship Adviser, Nadhim Zahawi MP, Skills Minister, Nick Boles and just under 100 MPs have kick-started a ‘100 in 100 apprenticeship campaign’, at an event held at Portcullis House in London.
Building on the government’s commitment to 3m apprenticeship starts by 2020, the campaign will see MPs across all political parties in England, securing apprenticeship pledges from businesses in their constituencies, with the aim of creating at least 100 new apprenticeships within the next 100 days.
Already over 400 apprenticeship places have been promised by international employers, including Balfour Beatty , Syngenta , MBDA , Atkins Global Group and Pendragon , who have made their pledges on the Pledgeometer , an online tool for businesses to share their apprenticeship and traineeship pledges in the run up to National Apprenticeship Week .
Skills Minister, Nick Boles said:
Apprenticeships are set to be one of the success stories of the decade. They deliver for business, our economy and offer life-changing opportunities for our young people. That’s exactly why we are committed to 3 million apprenticeships by 2020.
I am greatly encouraged to see so many MPs become apprenticeship champions and would urge even more to go out and encourage employers in their constituencies to create 100 apprenticeships in 100 days.
The Prime Minister’s apprenticeship adviser, Nadhim Zahawi MP said:
Now is the time for MPs from across the political spectrum to build on the growing momentum behind apprenticeships across their local constituencies. I am heartened by the optimism from businesses to create better products and greater services as a result of employing highly-skilled apprentices. Equally, local MPs can play their part by highlighting how apprenticeship opportunities can open doors for young people in their favoured careers.
To show your support on Twitter use #apprenticeships. Employers can find out more by talking to their local MP .
Published: 11 February 2016


| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.apache.commons.math3.util; | |
| 18 | ||
| 19 | import java.io.PrintStream; | |
| 20 | ||
| 21 | import org.apache.commons.math3.exception.DimensionMismatchException; | |
| 22 | ||
| 23 | /** Class used to compute the classical functions tables. | |
| 24 | * @version $Id: FastMathCalc.java 1416643 2012-12-03 19:37:14Z tn $ | |
| 25 | * @since 3.0 | |
| 26 | */ | |
| 27 | class FastMathCalc { | |
| 28 | ||
| 29 | /** | |
| 30 | * 0x40000000 - used to split a double into two parts, both with the low order bits cleared. | |
| 31 | * Equivalent to 2^30. | |
| 32 | */ | |
| 33 | private static final long HEX_40000000 = 0x40000000L; //<PHONE_NUMBER>L | |
| 34 | ||
| 35 | /** Factorial table, for Taylor series expansions. 0!, 1!, 2!, ... 19! */ | |
| 36 | private static final double FACT[] = new double[] | |
| 37 | { | |
| 38 | +1.0d, // 0 | |
| 39 | +1.0d, // 1 | |
| 40 | +2.0d, // 2 | |
| 41 | +6.0d, // 3 | |
| 42 | +24.0d, // 4 | |
| 43 | +120.0d, // 5 | |
| 44 | +720.0d, // 6 | |
| 45 | +5040.0d, // 7 | |
| 46 | +40320.0d, // 8 | |
| 47 | +362880.0d, // 9 | |
| 48 | +3628800.0d, // 10 | |
| 49 | +39916800.0d, // 11 | |
| 50 | +479001600.0d, // 12 | |
| 51 | +6227020800.0d, // 13 | |
| 52 | +87178291200.0d, // 14 | |
| 53 | +1307674368000.0d, // 15 | |
| 54 | +20922789888000.0d, // 16 | |
| 55 | +355687428096000.0d, // 17 | |
| 56 | +6402373705728000.0d, // 18 | |
| 57 | +121645100408832000.0d, // 19 | |
| 58 | }; | |
| 59 | ||
| 60 | /** Coefficients for slowLog. */ | |
| 61 | private static final double LN_SPLIT_COEF[][] = { | |
| 62 | {2.0, 0.0}, | |
| 63 | {0.6666666269302368, 3.9736429850260626E-8}, | |
| 64 | {0.3999999761581421, 2.3841857910019882E-8}, | |
| 65 | {0.2857142686843872, 1.7029898543501842E-8}, | |
| 66 | {0.2222222089767456, 1.3245471311735498E-8}, | |
| 67 | {0.1818181574344635, 2.4384203044354907E-8}, | |
| 68 | {0.1538461446762085, 9.140260083262505E-9}, | |
| 69 | {0.13333332538604736, 9.220590270857665E-9}, | |
| 70 | {0.11764700710773468, 1.2393345855018391E-8}, | |
| 71 | {0.10526403784751892, 8.251545029714408E-9}, | |
| 72 | {0.0952233225107193, 1.2675934823758863E-8}, | |
| 73 | {0.08713622391223907, 1.1430250008909141E-8}, | |
| 74 | {0.07842259109020233, 2.404307984052299E-9}, | |
| 75 | {0.08371849358081818, 1.176342548272881E-8}, | |
| 76 | {0.030589580535888672, 1.2958646899018938E-9}, | |
| 77 | {0.14982303977012634, 1.225743062930824E-8}, | |
| 78 | }; | |
| 79 | ||
| 80 | /** Table start declaration. */ | |
| 81 | private static final String TABLE_START_DECL = " {"; | |
| 82 | ||
| 83 | /** Table end declaration. */ | |
| 84 | private static final String TABLE_END_DECL = " };"; | |
| 85 | ||
| 86 | /** | |
| 87 | * Private Constructor. | |
| 88 | */ | |
| 89 | private FastMathCalc() { | |
| 90 | } | |
| 91 | ||
| 92 | /** Build the sine and cosine tables. | |
| 93 | * @param SINE_TABLE_A table of the most significant part of the sines | |
| 94 | * @param SINE_TABLE_B table of the least significant part of the sines | |
| 95 | * @param COSINE_TABLE_A table of the most significant part of the cosines | |
| 96 | * @param COSINE_TABLE_B table of the most significant part of the cosines | |
| 97 | * @param SINE_TABLE_LEN length of the tables | |
| 98 | * @param TANGENT_TABLE_A table of the most significant part of the tangents | |
| 99 | * @param TANGENT_TABLE_B table of the most significant part of the tangents | |
| 100 | */ | |
| 101 | @SuppressWarnings("unused") | |
| 102 | private static void buildSinCosTables(double[] SINE_TABLE_A, double[] SINE_TABLE_B, | |
| 103 | double[] COSINE_TABLE_A, double[] COSINE_TABLE_B, | |
| 104 | int SINE_TABLE_LEN, double[] TANGENT_TABLE_A, double[] TANGENT_TABLE_B) { | |
| 105 | final double result[] = new double[2]; | |
| 106 | ||
| 107 | /* Use taylor series for 0 <= x <= 6/8 */ | |
| 108 | 3 | for (int i = 0; i < 7; i++) { |
| 109 | 1 | double x = i / 8.0; |
| 110 | ||
| 111 | slowSin(x, result); | |
| 112 | SINE_TABLE_A[i] = result[0]; | |
| 113 | SINE_TABLE_B[i] = result[1]; | |
| 114 | ||
| 115 | slowCos(x, result); | |
| 116 | COSINE_TABLE_A[i] = result[0]; | |
| 117 | COSINE_TABLE_B[i] = result[1]; | |
| 118 | } | |
| 119 | ||
| 120 | /* Use angle addition formula to complete table to 13/8, just beyond pi/2 */ | |
| 121 | 3 | for (int i = 7; i < SINE_TABLE_LEN; i++) { |
| 122 | double xs[] = new double[2]; | |
| 123 | double ys[] = new double[2]; | |
| 124 | double as[] = new double[2]; | |
| 125 | double bs[] = new double[2]; | |
| 126 | double temps[] = new double[2]; | |
| 127 | ||
| 128 | 2 | if ( (i & 1) == 0) { |
| 129 | // Even, use double angle | |
| 130 | 1 | xs[0] = SINE_TABLE_A[i/2]; |
| 131 | 1 | xs[1] = SINE_TABLE_B[i/2]; |
| 132 | 1 | ys[0] = COSINE_TABLE_A[i/2]; |
| 133 | 1 | ys[1] = COSINE_TABLE_B[i/2]; |
| 134 | ||
| 135 | /* compute sine */ | |
| 136 | 1 | splitMult(xs, ys, result); |
| 137 | 1 | SINE_TABLE_A[i] = result[0] * 2.0; |
| 138 | 1 | SINE_TABLE_B[i] = result[1] * 2.0; |
| 139 | ||
| 140 | /* Compute cosine */ | |
| 141 | 1 | splitMult(ys, ys, as); |
| 142 | 1 | splitMult(xs, xs, temps); |
| 143 | 1 | temps[0] = -temps[0]; |
| 144 | 1 | temps[1] = -temps[1]; |
| 145 | 1 | splitAdd(as, temps, result); |
| 146 | COSINE_TABLE_A[i] = result[0]; | |
| 147 | COSINE_TABLE_B[i] = result[1]; | |
| 148 | } else { | |
| 149 | 1 | xs[0] = SINE_TABLE_A[i/2]; |
| 150 | 1 | xs[1] = SINE_TABLE_B[i/2]; |
| 151 | 1 | ys[0] = COSINE_TABLE_A[i/2]; |
| 152 | 1 | ys[1] = COSINE_TABLE_B[i/2]; |
| 153 | 2 | as[0] = SINE_TABLE_A[i/2+1]; |
| 154 | 2 | as[1] = SINE_TABLE_B[i/2+1]; |
| 155 | 2 | bs[0] = COSINE_TABLE_A[i/2+1]; |
| 156 | 2 | bs[1] = COSINE_TABLE_B[i/2+1]; |
| 157 | ||
| 158 | /* compute sine */ | |
| 159 | 1 | splitMult(xs, bs, temps); |
| 160 | 1 | splitMult(ys, as, result); |
| 161 | 1 | splitAdd(result, temps, result); |
| 162 | SINE_TABLE_A[i] = result[0]; | |
| 163 | SINE_TABLE_B[i] = result[1]; | |
| 164 | ||
| 165 | /* Compute cosine */ | |
| 166 | 1 | splitMult(ys, bs, result); |
| 167 | 1 | splitMult(xs, as, temps); |
| 168 | 1 | temps[0] = -temps[0]; |
| 169 | 1 | temps[1] = -temps[1]; |
| 170 | 1 | splitAdd(result, temps, result); |
| 171 | COSINE_TABLE_A[i] = result[0]; | |
| 172 | COSINE_TABLE_B[i] = result[1]; | |
| 173 | } | |
| 174 | } | |
| 175 | ||
| 176 | /* Compute tangent = sine/cosine */ | |
| 177 | 3 | for (int i = 0; i < SINE_TABLE_LEN; i++) { |
| 178 | double xs[] = new double[2]; | |
| 179 | double ys[] = new double[2]; | |
| 180 | double as[] = new double[2]; | |
| 181 | ||
| 182 | as[0] = COSINE_TABLE_A[i]; | |
| 183 | as[1] = COSINE_TABLE_B[i]; | |
| 184 | ||
| 185 | 1 | splitReciprocal(as, ys); |
| 186 | ||
| 187 | xs[0] = SINE_TABLE_A[i]; | |
| 188 | xs[1] = SINE_TABLE_B[i]; | |
| 189 | ||
| 190 | 1 | splitMult(xs, ys, as); |
| 191 | ||
| 192 | TANGENT_TABLE_A[i] = as[0]; | |
| 193 | TANGENT_TABLE_B[i] = as[1]; | |
| 194 | } | |
| 195 | ||
| 196 | } | |
| 197 | ||
| 198 | /** | |
| 199 | * For x between 0 and pi/4 compute cosine using Talor series | |
| 200 | * cos(x) = 1 - x^2/2! + x^4/4! ... | |
| 201 | * @param x number from which cosine is requested | |
| 202 | * @param result placeholder where to put the result in extended precision | |
| 203 | * (may be null) | |
| 204 | * @return cos(x) | |
| 205 | */ | |
| 206 | static double slowCos(final double x, final double result[]) { | |
| 207 | ||
| 208 | final double xs[] = new double[2]; | |
| 209 | final double ys[] = new double[2]; | |
| 210 | final double facts[] = new double[2]; | |
| 211 | final double as[] = new double[2]; | |
| 212 | 1 | split(x, xs); |
| 213 | ys[0] = ys[1] = 0.0; | |
| 214 | ||
| 215 | 4 | for (int i = FACT.length-1; i >= 0; i--) { |
| 216 | 1 | splitMult(xs, ys, as); |
| 217 | ys[0] = as[0]; ys[1] = as[1]; | |
| 218 | ||
| 219 | 2 | if ( (i & 1) != 0) { // skip odd entries |
| 220 | continue; | |
| 221 | } | |
| 222 | ||
| 223 | 1 | split(FACT[i], as); |
| 224 | 1 | splitReciprocal(as, facts); |
| 225 | ||
| 226 | 2 | if ( (i & 2) != 0 ) { // alternate terms are negative |
| 227 | 1 | facts[0] = -facts[0]; |
| 228 | 1 | facts[1] = -facts[1]; |
| 229 | } | |
| 230 | ||
| 231 | 1 | splitAdd(ys, facts, as); |
| 232 | ys[0] = as[0]; ys[1] = as[1]; | |
| 233 | } | |
| 234 | ||
| 235 | 1 | if (result != null) { |
| 236 | result[0] = ys[0]; | |
| 237 | result[1] = ys[1]; | |
| 238 | } | |
| 239 | ||
| 240 | 2 | return ys[0] + ys[1]; |
| 241 | } | |
| 242 | ||
| 243 | /** | |
| 244 | * For x between 0 and pi/4 compute sine using Taylor expansion: | |
| 245 | * sin(x) = x - x^3/3! + x^5/5! - x^7/7! ... | |
| 246 | * @param x number from which sine is requested | |
| 247 | * @param result placeholder where to put the result in extended precision | |
| 248 | * (may be null) | |
| 249 | * @return sin(x) | |
| 250 | */ | |
| 251 | static double slowSin(final double x, final double result[]) { | |
| 252 | final double xs[] = new double[2]; | |
| 253 | final double ys[] = new double[2]; | |
| 254 | final double facts[] = new double[2]; | |
| 255 | final double as[] = new double[2]; | |
| 256 | 1 | split(x, xs); |
| 257 | ys[0] = ys[1] = 0.0; | |
| 258 | ||
| 259 | 4 | for (int i = FACT.length-1; i >= 0; i--) { |
| 260 | 1 | splitMult(xs, ys, as); |
| 261 | ys[0] = as[0]; ys[1] = as[1]; | |
| 262 | ||
| 263 | 2 | if ( (i & 1) == 0) { // Ignore even numbers |
| 264 | continue; | |
| 265 | } | |
| 266 | ||
| 267 | 1 | split(FACT[i], as); |
| 268 | 1 | splitReciprocal(as, facts); |
| 269 | ||
| 270 | 2 | if ( (i & 2) != 0 ) { // alternate terms are negative |
| 271 | 1 | facts[0] = -facts[0]; |
| 272 | 1 | facts[1] = -facts[1]; |
| 273 | } | |
| 274 | ||
| 275 | 1 | splitAdd(ys, facts, as); |
| 276 | ys[0] = as[0]; ys[1] = as[1]; | |
| 277 | } | |
| 278 | ||
| 279 | 1 | if (result != null) { |
| 280 | result[0] = ys[0]; | |
| 281 | result[1] = ys[1]; | |
| 282 | } | |
| 283 | ||
| 284 | 2 | return ys[0] + ys[1]; |
| 285 | } | |
| 286 | ||
| 287 | ||
| 288 | /** | |
| 289 | * For x between 0 and 1, returns exp(x), uses extended precision | |
| 290 | * @param x argument of exponential | |
| 291 | * @param result placeholder where to place exp(x) split in two terms | |
| 292 | * for extra precision (i.e. exp(x) = result[0] + result[1] | |
| 293 | * @return exp(x) | |
| 294 | */ | |
| 295 | static double slowexp(final double x, final double result[]) { | |
| 296 | final double xs[] = new double[2]; | |
| 297 | final double ys[] = new double[2]; | |
| 298 | final double facts[] = new double[2]; | |
| 299 | final double as[] = new double[2]; | |
| 300 | 1 | split(x, xs); |
| 301 | ys[0] = ys[1] = 0.0; | |
| 302 | ||
| 303 | 4 | for (int i = FACT.length-1; i >= 0; i--) { |
| 304 | 1 | splitMult(xs, ys, as); |
| 305 | ys[0] = as[0]; | |
| 306 | ys[1] = as[1]; | |
| 307 | ||
| 308 | 1 | split(FACT[i], as); |
| 309 | 1 | splitReciprocal(as, facts); |
| 310 | ||
| 311 | 1 | splitAdd(ys, facts, as); |
| 312 | ys[0] = as[0]; | |
| 313 | ys[1] = as[1]; | |
| 314 | } | |
| 315 | ||
| 316 | 1 | if (result != null) { |
| 317 | result[0] = ys[0]; | |
| 318 | result[1] = ys[1]; | |
| 319 | } | |
| 320 | ||
| 321 | 2 | return ys[0] + ys[1]; |
| 322 | } | |
| 323 | ||
| 324 | /** Compute split[0], split[1] such that their sum is equal to d, | |
| 325 | * and split[0] has its 30 least significant bits as zero. | |
| 326 | * @param d number to split | |
| 327 | * @param split placeholder where to place the result | |
| 328 | */ | |
| 329 | private static void split(final double d, final double split[]) { | |
| 330 | 4 | if (d < 8e298 && d > -8e298) { |
| 331 | 1 | final double a = d * HEX_40000000; |
| 332 | 2 | split[0] = (d + a) - a; |
| 333 | 1 | split[1] = d - split[0]; |
| 334 | } else { | |
| 335 | 1 | final double a = d * 9.31322574615478515625E-10; |
| 336 | 3 | split[0] = (d + a - d) * HEX_40000000; |
| 337 | 1 | split[1] = d - split[0]; |
| 338 | } | |
| 339 | } | |
| 340 | ||
| 341 | /** Recompute a split. | |
| 342 | * @param a input/out array containing the split, changed | |
| 343 | * on output | |
| 344 | */ | |
| 345 | private static void resplit(final double a[]) { | |
| 346 | 1 | final double c = a[0] + a[1]; |
| 347 | 3 | final double d = -(c - a[0] - a[1]); |
| 348 | ||
| 349 | 4 | if (c < 8e298 && c > -8e298) { // MAGIC NUMBER |
| 350 | 1 | double z = c * HEX_40000000; |
| 351 | 2 | a[0] = (c + z) - z; |
| 352 | 2 | a[1] = c - a[0] + d; |
| 353 | } else { | |
| 354 | 1 | double z = c * 9.31322574615478515625E-10; |
| 355 | 3 | a[0] = (c + z - c) * HEX_40000000; |
| 356 | 2 | a[1] = c - a[0] + d; |
| 357 | } | |
| 358 | } | |
| 359 | ||
| 360 | /** Multiply two numbers in split form. | |
| 361 | * @param a first term of multiplication | |
| 362 | * @param b second term of multiplication | |
| 363 | * @param ans placeholder where to put the result | |
| 364 | */ | |
| 365 | private static void splitMult(double a[], double b[], double ans[]) { | |
| 366 | 1 | ans[0] = a[0] * b[0]; |
| 367 | 5 | ans[1] = a[0] * b[1] + a[1] * b[0] + a[1] * b[1]; |
| 368 | ||
| 369 | /* Resplit */ | |
| 370 | 1 | resplit(ans); |
| 371 | } | |
| 372 | ||
| 373 | /** Add two numbers in split form. | |
| 374 | * @param a first term of addition | |
| 375 | * @param b second term of addition | |
| 376 | * @param ans placeholder where to put the result | |
| 377 | */ | |
| 378 | private static void splitAdd(final double a[], final double b[], final double ans[]) { | |
| 379 | 1 | ans[0] = a[0] + b[0]; |
| 380 | 1 | ans[1] = a[1] + b[1]; |
| 381 | ||
| 382 | 1 | resplit(ans); |
| 383 | } | |
| 384 | ||
| 385 | /** Compute the reciprocal of in. Use the following algorithm. | |
| 386 | * in = c + d. | |
| 387 | * want to find x + y such that x+y = 1/(c+d) and x is much | |
| 388 | * larger than y and x has several zero bits on the right. | |
| 389 | * | |
| 390 | * Set b = 1/(2^22), a = 1 - b. Thus (a+b) = 1. | |
| 391 | * Use following identity to compute (a+b)/(c+d) | |
| 392 | * | |
| 393 | * (a+b)/(c+d) = a/c + (bc - ad) / (c^2 + cd) | |
| 394 | * set x = a/c and y = (bc - ad) / (c^2 + cd) | |
| 395 | * This will be close to the right answer, but there will be | |
| 396 | * some rounding in the calculation of X. So by carefully | |
| 397 | * computing 1 - (c+d)(x+y) we can compute an error and | |
| 398 | * add that back in. This is done carefully so that terms | |
| 399 | * of similar size are subtracted first. | |
| 400 | * @param in initial number, in split form | |
| 401 | * @param result placeholder where to put the result | |
| 402 | */ | |
| 403 | static void splitReciprocal(final double in[], final double result[]) { | |
| 404 | final double b = 1.0/4194304.0; | |
| 405 | final double a = 1.0 - b; | |
| 406 | ||
| 407 | 1 | if (in[0] == 0.0) { |
| 408 | in[0] = in[1]; | |
| 409 | in[1] = 0.0; | |
| 410 | } | |
| 411 | ||
| 412 | 1 | result[0] = a / in[0]; |
| 413 | 7 | result[1] = (b*in[0]-a*in[1]) / (in[0]*in[0] + in[0]*in[1]); |
| 414 | ||
| 415 | 1 | if (result[1] != result[1]) { // can happen if result[1] is NAN |
| 416 | result[1] = 0.0; | |
| 417 | } | |
| 418 | ||
| 419 | /* Resplit */ | |
| 420 | 1 | resplit(result); |
| 421 | ||
| 422 | 3 | for (int i = 0; i < 2; i++) { |
| 423 | /* this may be overkill, probably once is enough */ | |
| 424 | 8 | double err = 1.0 - result[0] * in[0] - result[0] * in[1] - |
| 425 | result[1] * in[0] - result[1] * in[1]; | |
| 426 | /*err = 1.0 - err; */ | |
| 427 | 2 | err = err * (result[0] + result[1]); |
| 428 | /*printf("err = %16e\n", err); */ | |
| 429 | 1 | result[1] += err; |
| 430 | } | |
| 431 | } | |
| 432 | ||
| 433 | /** Compute (a[0] + a[1]) * (b[0] + b[1]) in extended precision. | |
| 434 | * @param a first term of the multiplication | |
| 435 | * @param b second term of the multiplication | |
| 436 | * @param result placeholder where to put the result | |
| 437 | */ | |
| 438 | private static void quadMult(final double a[], final double b[], final double result[]) { | |
| 439 | final double xs[] = new double[2]; | |
| 440 | final double ys[] = new double[2]; | |
| 441 | final double zs[] = new double[2]; | |
| 442 | ||
| 443 | /* a[0] * b[0] */ | |
| 444 | 1 | split(a[0], xs); |
| 445 | 1 | split(b[0], ys); |
| 446 | 1 | splitMult(xs, ys, zs); |
| 447 | ||
| 448 | result[0] = zs[0]; | |
| 449 | result[1] = zs[1]; | |
| 450 | ||
| 451 | /* a[0] * b[1] */ | |
| 452 | 1 | split(b[1], ys); |
| 453 | 1 | splitMult(xs, ys, zs); |
| 454 | ||
| 455 | 1 | double tmp = result[0] + zs[0]; |
| 456 | 3 | result[1] = result[1] - (tmp - result[0] - zs[0]); |
| 457 | result[0] = tmp; | |
| 458 | 1 | tmp = result[0] + zs[1]; |
| 459 | 3 | result[1] = result[1] - (tmp - result[0] - zs[1]); |
| 460 | result[0] = tmp; | |
| 461 | ||
| 462 | /* a[1] * b[0] */ | |
| 463 | 1 | split(a[1], xs); |
| 464 | 1 | split(b[0], ys); |
| 465 | 1 | splitMult(xs, ys, zs); |
| 466 | ||
| 467 | 1 | tmp = result[0] + zs[0]; |
| 468 | 3 | result[1] = result[1] - (tmp - result[0] - zs[0]); |
| 469 | result[0] = tmp; | |
| 470 | 1 | tmp = result[0] + zs[1]; |
| 471 | 3 | result[1] = result[1] - (tmp - result[0] - zs[1]); |
| 472 | result[0] = tmp; | |
| 473 | ||
| 474 | /* a[1] * b[0] */ | |
| 475 | 1 | split(a[1], xs); |
| 476 | 1 | split(b[1], ys); |
| 477 | 1 | splitMult(xs, ys, zs); |
| 478 | ||
| 479 | 1 | tmp = result[0] + zs[0]; |
| 480 | 3 | result[1] = result[1] - (tmp - result[0] - zs[0]); |
| 481 | result[0] = tmp; | |
| 482 | 1 | tmp = result[0] + zs[1]; |
| 483 | 3 | result[1] = result[1] - (tmp - result[0] - zs[1]); |
| 484 | result[0] = tmp; | |
| 485 | } | |
| 486 | ||
| 487 | /** Compute exp(p) for a integer p in extended precision. | |
| 488 | * @param p integer whose exponential is requested | |
| 489 | * @param result placeholder where to put the result in extended precision | |
| 490 | * @return exp(p) in standard precision (equal to result[0] + result[1]) | |
| 491 | */ | |
| 492 | static double expint(int p, final double result[]) { | |
| 493 | //double x = M_E; | |
| 494 | final double xs[] = new double[2]; | |
| 495 | final double as[] = new double[2]; | |
| 496 | final double ys[] = new double[2]; | |
| 497 | //split(x, xs); | |
| 498 | //xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]); | |
| 499 | //xs[0] = 2.71827697753906250000; | |
| 500 | //xs[1] = 4.85091998273542816811e-06; | |
| 501 | //xs[0] = Double.longBitsToDouble(0x4005bf0800000000L); | |
| 502 | //xs[1] = Double.longBitsToDouble(0x3ed458a2bb4a9b00L); | |
| 503 | ||
| 504 | /* E */ | |
| 505 | xs[0] = 2.718281828459045; | |
| 506 | xs[1] = 1.4456468917292502E-16; | |
| 507 | ||
| 508 | 1 | split(1.0, ys); |
| 509 | ||
| 510 | 2 | while (p > 0) { |
| 511 | 2 | if ((p & 1) != 0) { |
| 512 | 1 | quadMult(ys, xs, as); |
| 513 | ys[0] = as[0]; ys[1] = as[1]; | |
| 514 | } | |
| 515 | ||
| 516 | 1 | quadMult(xs, xs, as); |
| 517 | xs[0] = as[0]; xs[1] = as[1]; | |
| 518 | ||
| 519 | 1 | p >>= 1; |
| 520 | } | |
| 521 | ||
| 522 | 1 | if (result != null) { |
| 523 | result[0] = ys[0]; | |
| 524 | result[1] = ys[1]; | |
| 525 | ||
| 526 | 1 | resplit(result); |
| 527 | } | |
| 528 | ||
| 529 | 2 | return ys[0] + ys[1]; |
| 530 | } | |
| 531 | /** xi in the range of [1, 2]. | |
| 532 | * 3 5 7 | |
| 533 | * x+1 / x x x \ | |
| 534 | * ln ----- = 2 * | x + ---- + ---- + ---- + ... | | |
| 535 | * 1-x \ 3 5 7 / | |
| 536 | * | |
| 537 | * So, compute a Remez approximation of the following function | |
| 538 | * | |
| 539 | * ln ((sqrt(x)+1)/(1-sqrt(x))) / x | |
| 540 | * | |
| 541 | * This will be an even function with only positive coefficents. | |
| 542 | * x is in the range [0 - 1/3]. | |
| 543 | * | |
| 544 | * Transform xi for input to the above function by setting | |
| 545 | * x = (xi-1)/(xi+1). Input to the polynomial is x^2, then | |
| 546 | * the result is multiplied by x. | |
| 547 | * @param xi number from which log is requested | |
| 548 | * @return log(xi) | |
| 549 | */ | |
| 550 | static double[] slowLog(double xi) { | |
| 551 | double x[] = new double[2]; | |
| 552 | double x2[] = new double[2]; | |
| 553 | double y[] = new double[2]; | |
| 554 | double a[] = new double[2]; | |
| 555 | ||
| 556 | 1 | split(xi, x); |
| 557 | ||
| 558 | /* Set X = (x-1)/(x+1) */ | |
| 559 | 1 | x[0] += 1.0; |
| 560 | 1 | resplit(x); |
| 561 | 1 | splitReciprocal(x, a); |
| 562 | 1 | x[0] -= 2.0; |
| 563 | 1 | resplit(x); |
| 564 | 1 | splitMult(x, a, y); |
| 565 | x[0] = y[0]; | |
| 566 | x[1] = y[1]; | |
| 567 | ||
| 568 | /* Square X -> X2*/ | |
| 569 | 1 | splitMult(x, x, x2); |
| 570 | ||
| 571 | ||
| 572 | //x[0] -= 1.0; | |
| 573 | //resplit(x); | |
| 574 | ||
| 575 | 1 | y[0] = LN_SPLIT_COEF[LN_SPLIT_COEF.length-1][0]; |
| 576 | 1 | y[1] = LN_SPLIT_COEF[LN_SPLIT_COEF.length-1][1]; |
| 577 | ||
| 578 | 4 | for (int i = LN_SPLIT_COEF.length-2; i >= 0; i--) { |
| 579 | 1 | splitMult(y, x2, a); |
| 580 | y[0] = a[0]; | |
| 581 | y[1] = a[1]; | |
| 582 | 1 | splitAdd(y, LN_SPLIT_COEF[i], a); |
| 583 | y[0] = a[0]; | |
| 584 | y[1] = a[1]; | |
| 585 | } | |
| 586 | ||
| 587 | 1 | splitMult(y, x, a); |
| 588 | y[0] = a[0]; | |
| 589 | y[1] = a[1]; | |
| 590 | ||
| 591 | 1 | return y; |
| 592 | } | |
| 593 | ||
| 594 | ||
| 595 | /** | |
| 596 | * Print an array. | |
| 597 | * @param out text output stream where output should be printed | |
| 598 | * @param name array name | |
| 599 | * @param expectedLen expected length of the array | |
| 600 | * @param array2d array data | |
| 601 | */ | |
| 602 | static void printarray(PrintStream out, String name, int expectedLen, double[][] array2d) { | |
| 603 | 1 | out.println(name); |
| 604 | 1 | checkLen(expectedLen, array2d.length); |
| 605 | 1 | out.println(TABLE_START_DECL + " "); |
| 606 | int i = 0; | |
| 607 | 3 | for(double[] array : array2d) { // "double array[]" causes PMD parsing error |
| 608 | 1 | out.print(" {"); |
| 609 | 3 | for(double d : array) { // assume inner array has very few entries |
| 610 | out.printf("%-25.25s", format(d)); // multiple entries per line | |
| 611 | } | |
| 612 | 2 | out.println("}, // " + i++); |
| 613 | } | |
| 614 | 1 | out.println(TABLE_END_DECL); |
| 615 | } | |
| 616 | ||
| 617 | /** | |
| 618 | * Print an array. | |
| 619 | * @param out text output stream where output should be printed | |
| 620 | * @param name array name | |
| 621 | * @param expectedLen expected length of the array | |
| 622 | * @param array array data | |
| 623 | */ | |
| 624 | static void printarray(PrintStream out, String name, int expectedLen, double[] array) { | |
| 625 | 1 | out.println(name + "="); |
| 626 | 1 | checkLen(expectedLen, array.length); |
| 627 | 1 | out.println(TABLE_START_DECL); |
| 628 | 3 | for(double d : array){ |
| 629 | out.printf(" %s%n", format(d)); // one entry per line | |
| 630 | } | |
| 631 | 1 | out.println(TABLE_END_DECL); |
| 632 | } | |
| 633 | ||
| 634 | /** Format a double. | |
| 635 | * @param d double number to format | |
| 636 | * @return formatted number | |
| 637 | */ | |
| 638 | static String format(double d) { | |
| 639 | 1 | if (d != d) { |
| 640 | 1 | return "Double.NaN,"; |
| 641 | } else { | |
| 642 | 3 | return ((d >= 0) ? "+" : "") + Double.toString(d) + "d,"; |
| 643 | } | |
| 644 | } | |
| 645 | ||
| 646 | /** | |
| 647 | * Check two lengths are equal. | |
| 648 | * @param expectedLen expected length | |
| 649 | * @param actual actual length | |
| 650 | * @exception DimensionMismatchException if the two lengths are not equal | |
| 651 | */ | |
| 652 | private static void checkLen(int expectedLen, int actual) | |
| 653 | throws DimensionMismatchException { | |
| 654 | 1 | if (expectedLen != actual) { |
| 655 | throw new DimensionMismatchException(actual, expectedLen); | |
| 656 | } | |
| 657 | } | |
| 658 | ||
| 659 | } | |
Mutations | ||
| 108 |
negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE Changed increment from 1 to -1 : NO_COVERAGE |
|
| 109 |
Replaced double division with multiplication : NO_COVERAGE |
|
| 121 |
Changed increment from 1 to -1 : NO_COVERAGE negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE |
|
| 128 |
Replaced bitwise AND with OR : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 130 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 131 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 132 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 133 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 136 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 137 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 138 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 141 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 142 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 143 |
removed negation : NO_COVERAGE |
|
| 144 |
removed negation : NO_COVERAGE |
|
| 145 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 149 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 150 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 151 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 152 |
Replaced integer division with multiplication : NO_COVERAGE |
|
| 153 |
Replaced integer division with multiplication : NO_COVERAGE Replaced integer addition with subtraction : NO_COVERAGE |
|
| 154 |
Replaced integer division with multiplication : NO_COVERAGE Replaced integer addition with subtraction : NO_COVERAGE |
|
| 155 |
Replaced integer addition with subtraction : NO_COVERAGE Replaced integer division with multiplication : NO_COVERAGE |
|
| 156 |
Replaced integer addition with subtraction : NO_COVERAGE Replaced integer division with multiplication : NO_COVERAGE |
|
| 159 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 160 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 161 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 166 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 167 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 168 |
removed negation : NO_COVERAGE |
|
| 169 |
removed negation : NO_COVERAGE |
|
| 170 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 177 |
negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE Changed increment from 1 to -1 : NO_COVERAGE |
|
| 185 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitReciprocal : NO_COVERAGE |
|
| 190 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 212 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 215 |
changed conditional boundary : NO_COVERAGE Changed increment from -1 to 1 : NO_COVERAGE negated conditional : NO_COVERAGE Replaced integer subtraction with addition : NO_COVERAGE |
|
| 216 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 219 |
Replaced bitwise AND with OR : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 223 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 224 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitReciprocal : NO_COVERAGE |
|
| 226 |
negated conditional : NO_COVERAGE Replaced bitwise AND with OR : NO_COVERAGE |
|
| 227 |
removed negation : NO_COVERAGE |
|
| 228 |
removed negation : NO_COVERAGE |
|
| 231 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 235 |
negated conditional : NO_COVERAGE |
|
| 240 |
Replaced double addition with subtraction : NO_COVERAGE replaced return of double value with -(x + 1) for org/apache/commons/math3/util/FastMathCalc::slowCos : NO_COVERAGE |
|
| 256 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 259 |
Changed increment from -1 to 1 : NO_COVERAGE negated conditional : NO_COVERAGE Replaced integer subtraction with addition : NO_COVERAGE changed conditional boundary : NO_COVERAGE |
|
| 260 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 263 |
negated conditional : NO_COVERAGE Replaced bitwise AND with OR : NO_COVERAGE |
|
| 267 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 268 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitReciprocal : NO_COVERAGE |
|
| 270 |
negated conditional : NO_COVERAGE Replaced bitwise AND with OR : NO_COVERAGE |
|
| 271 |
removed negation : NO_COVERAGE |
|
| 272 |
removed negation : NO_COVERAGE |
|
| 275 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 279 |
negated conditional : NO_COVERAGE |
|
| 284 |
Replaced double addition with subtraction : NO_COVERAGE replaced return of double value with -(x + 1) for org/apache/commons/math3/util/FastMathCalc::slowSin : NO_COVERAGE |
|
| 300 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 303 |
negated conditional : NO_COVERAGE Replaced integer subtraction with addition : NO_COVERAGE Changed increment from -1 to 1 : NO_COVERAGE changed conditional boundary : NO_COVERAGE |
|
| 304 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 308 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 309 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitReciprocal : NO_COVERAGE |
|
| 311 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 316 |
negated conditional : NO_COVERAGE |
|
| 321 |
Replaced double addition with subtraction : NO_COVERAGE replaced return of double value with -(x + 1) for org/apache/commons/math3/util/FastMathCalc::slowexp : NO_COVERAGE |
|
| 330 |
changed conditional boundary : NO_COVERAGE changed conditional boundary : NO_COVERAGE negated conditional : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 331 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 332 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double addition with subtraction : NO_COVERAGE |
|
| 333 |
Replaced double subtraction with addition : NO_COVERAGE |
|
| 335 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 336 |
Replaced double addition with subtraction : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE |
|
| 337 |
Replaced double subtraction with addition : NO_COVERAGE |
|
| 346 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 347 |
Replaced double subtraction with addition : NO_COVERAGE removed negation : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 349 |
changed conditional boundary : NO_COVERAGE changed conditional boundary : NO_COVERAGE negated conditional : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 350 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 351 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double addition with subtraction : NO_COVERAGE |
|
| 352 |
Replaced double addition with subtraction : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 354 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 355 |
Replaced double multiplication with division : NO_COVERAGE Replaced double addition with subtraction : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 356 |
Replaced double addition with subtraction : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 366 |
Replaced double multiplication with division : NO_COVERAGE |
|
| 367 |
Replaced double addition with subtraction : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double addition with subtraction : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE |
|
| 370 |
removed call to org/apache/commons/math3/util/FastMathCalc::resplit : NO_COVERAGE |
|
| 379 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 380 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 382 |
removed call to org/apache/commons/math3/util/FastMathCalc::resplit : NO_COVERAGE |
|
| 407 |
negated conditional : NO_COVERAGE |
|
| 412 |
Replaced double division with multiplication : NO_COVERAGE |
|
| 413 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double division with multiplication : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double addition with subtraction : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE |
|
| 415 |
negated conditional : NO_COVERAGE |
|
| 420 |
removed call to org/apache/commons/math3/util/FastMathCalc::resplit : NO_COVERAGE |
|
| 422 |
negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE Changed increment from 1 to -1 : NO_COVERAGE |
|
| 424 |
Replaced double multiplication with division : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double multiplication with division : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 427 |
Replaced double multiplication with division : NO_COVERAGE Replaced double addition with subtraction : NO_COVERAGE |
|
| 429 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 444 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 445 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 446 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 452 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 453 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 455 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 456 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 458 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 459 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 463 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 464 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 465 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 467 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 468 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 470 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 471 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 475 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 476 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 477 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 479 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 480 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 482 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 483 |
Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE Replaced double subtraction with addition : NO_COVERAGE |
|
| 508 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 510 |
negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE |
|
| 511 |
Replaced bitwise AND with OR : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 512 |
removed call to org/apache/commons/math3/util/FastMathCalc::quadMult : NO_COVERAGE |
|
| 516 |
removed call to org/apache/commons/math3/util/FastMathCalc::quadMult : NO_COVERAGE |
|
| 519 |
Replaced Shift Right with Shift Left : NO_COVERAGE |
|
| 522 |
negated conditional : NO_COVERAGE |
|
| 526 |
removed call to org/apache/commons/math3/util/FastMathCalc::resplit : NO_COVERAGE |
|
| 529 |
Replaced double addition with subtraction : NO_COVERAGE replaced return of double value with -(x + 1) for org/apache/commons/math3/util/FastMathCalc::expint : NO_COVERAGE |
|
| 556 |
removed call to org/apache/commons/math3/util/FastMathCalc::split : NO_COVERAGE |
|
| 559 |
Replaced double addition with subtraction : NO_COVERAGE |
|
| 560 |
removed call to org/apache/commons/math3/util/FastMathCalc::resplit : NO_COVERAGE |
|
| 561 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitReciprocal : NO_COVERAGE |
|
| 562 |
Replaced double subtraction with addition : NO_COVERAGE |
|
| 563 |
removed call to org/apache/commons/math3/util/FastMathCalc::resplit : NO_COVERAGE |
|
| 564 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 569 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 575 |
Replaced integer subtraction with addition : NO_COVERAGE |
|
| 576 |
Replaced integer subtraction with addition : NO_COVERAGE |
|
| 578 |
changed conditional boundary : NO_COVERAGE negated conditional : NO_COVERAGE Replaced integer subtraction with addition : NO_COVERAGE Changed increment from -1 to 1 : NO_COVERAGE |
|
| 579 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 582 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitAdd : NO_COVERAGE |
|
| 587 |
removed call to org/apache/commons/math3/util/FastMathCalc::splitMult : NO_COVERAGE |
|
| 591 |
mutated return of Object value for org/apache/commons/math3/util/FastMathCalc::slowLog to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 603 |
removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 604 |
removed call to org/apache/commons/math3/util/FastMathCalc::checkLen : NO_COVERAGE |
|
| 605 |
removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 607 |
negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE Changed increment from 1 to -1 : NO_COVERAGE |
|
| 608 |
removed call to java/io/PrintStream::print : NO_COVERAGE |
|
| 609 |
negated conditional : NO_COVERAGE Changed increment from 1 to -1 : NO_COVERAGE changed conditional boundary : NO_COVERAGE |
|
| 612 |
Changed increment from 1 to -1 : NO_COVERAGE removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 614 |
removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 625 |
removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 626 |
removed call to org/apache/commons/math3/util/FastMathCalc::checkLen : NO_COVERAGE |
|
| 627 |
removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 628 |
Changed increment from 1 to -1 : NO_COVERAGE negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE |
|
| 631 |
removed call to java/io/PrintStream::println : NO_COVERAGE |
|
| 639 |
negated conditional : NO_COVERAGE |
|
| 640 |
mutated return of Object value for org/apache/commons/math3/util/FastMathCalc::format to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 642 |
negated conditional : NO_COVERAGE changed conditional boundary : NO_COVERAGE mutated return of Object value for org/apache/commons/math3/util/FastMathCalc::format to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 654 |
negated conditional : NO_COVERAGE |


|
XOR Search
Key Matches:
|
Comments |
Objects {% comment %} Import these so they are available for the static-forms {% endcomment %} {% include "dialogs/add-object.html" %} {% include "dialogs/comments.html" %} |


We combine multiple sources of data into a single cohesive knowledge graph, forming linkages to relate similar concepts.
Recipes can be derived from a multitude of sources, such as books, websites, and structured datasets. For the purposes of the publication dataset, we chose to use a collection of recipes gathered by the authors of and used in the making of the Im2Recipe project.
Nutrient information can be found in great quantities for a variety of foods. We chose to source our data from the USDA. To bring the data they provide into the knowledge graph, we took advantage of Semantic Data Dictionaries, an RPI project. The files used in the Semantic Data Dictionary process is available in this folder. The dictionary mapping file specifies all the linkages made to external ontologies, such as FoodOn, Units Ontology etc.
We make available a sample of the FoodKG (USDA mappings) that were created using the Semantc Data Dictionary process.
You will need to manually acquire the following:
To build, Python 3.7 is required as some of the prerequisite packages depend on the bundled packages with Python 3.7.
After cloning the repository, detailed instructions for reproduction are available under the /src directory. A broad overview follows:
The following two files are required from Recipe1M:
Other public data sources (e.g., USDA, FoodOn) are downloaded automatically by the script.
The final output comprises the serialized RDF data iles comprising the FoodKG:
These files can be loaded into a graph database like BlazeGraph for executing the natural language queries.


Based on the current state of the COVID-19, we have decided to cancel the San Francisco Tango Exchange (SFTX) 2020, initially scheduled for August 29 – 30, 2020.
We genuinely appreciate all the interest and enthusiasm our tango community has shown towards this initiative. We were overwhelmed by the support at our fundraiser milonga at The Dome before California went into lockdown in March. It aches us that we must cancel our plans to gather everybody this summer. The health and safety of all is our #1 priority. We will hold the funds raised towards our future event.
We currently do not have a future date chosen yet. We will gauge the community’s interest again when it is realistic to reboot SFTX without reservation, hesitation, or fear.
Please take care of yourself and your loved ones. Stay sane, stay safe, and stay healthy until we meet and dance again.
From the SFTX team to you, with love.
Credit to Yi Jun Lin for SFTX dynamic logos.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.
SFTX is run under the umbrella of Project Tango, a 501(c)(3) nonprofit organization.
Your tax-deductible gift will help us in our mission to foster and develop a creative and inclusive tango community.
If you wish to contribute via paypal, please send your donation to info@sftangoexchange.com


{{range strings "id_address_map" "address" "address != id"}}
{{$addr := .}}
{{$addr}}
{{qstr "select count(distinct cid) from messages where \"from\"=$1" $addr}} outmsgs;
{{qstr "select count(distinct cid) from messages where \"to\"=$1" $addr}} inmsgs
{{end}}


Variations
These are some variations on the illusions featured on this site that I have created. Each one makes use of base principles from other illusions to create a stronger or outright different effect.
These are some variations on the illusions featured on this site that I have created. Each one makes use of base principles from other illusions to create a stronger or outright different effect.


--- layout: post title: 'pgBadger HTML5 overhaul : preview' ---
pgBadger is a powerful tool to optimize your PostgreSQL servers. Using your server log files, pgBadger will analyze the SQL traffic and produce a profusion of statistics (longest queries, read/write ratio, etc.). This is very helpful but the amount of data generated is so big that the pgbadger reports are hard to read and useful stats are often drown in the flood... Check out this sample pgBadger report to see the mess !
Since my previous blog post, we've been working hard to redefine the pgBadger user experience and create a new report template.
Here's the first draft of this new prototype (For now the draft is just static HTML code, we hope we'll have a live demo in the forthcoming weeks).
As you can we followed a few basic principles :
As you can see, there's nothing either out of the ordinary or very original here. But this new design will surely be easier to read and be more insightful. We hope it will attract new users, while being more helpful for the existing user base.
If you have any comment or ideas, please join the pgBadger mailing list and get involved !


|
ReactPhysics3D
0.8.0
C++ Physics engine library
|
This class represents a rigid body of the physics engine. More...
#include <RigidBody.h>
Public Member Functions | |
| RigidBody (PhysicsWorld &world, Entity entity) | |
| Constructor. More... | |
| virtual | ~RigidBody () override=default |
| Destructor. | |
| RigidBody (const RigidBody &body)=delete | |
| Deleted copy-constructor. | |
| RigidBody & | operator= (const RigidBody &body)=delete |
| Deleted assignment operator. | |
| virtual void | setTransform (const Transform &transform) override |
| Set the current position and orientation. More... | |
| decimal | getMass () const |
| Return the mass of the body. More... | |
| void | setMass (decimal mass) |
| Set the mass of the rigid body. More... | |
| Vector3 | getLinearVelocity () const |
| Return the linear velocity. More... | |
| void | setLinearVelocity (const Vector3 &linearVelocity) |
| Set the linear velocity of the body. More... | |
| Vector3 | getAngularVelocity () const |
| Return the angular velocity. More... | |
| void | setAngularVelocity (const Vector3 &angularVelocity) |
| Set the angular velocity. More... | |
| const Vector3 & | getLocalInertiaTensor () const |
| Return the local inertia tensor of the body (in body coordinates) More... | |
| void | setLocalInertiaTensor (const Vector3 &inertiaTensorLocal) |
| Set the local inertia tensor of the body (in body coordinates) More... | |
| const Vector3 & | getLocalCenterOfMass () const |
| Return the center of mass of the body (in local-space coordinates) More... | |
| void | setLocalCenterOfMass (const Vector3 ¢erOfMass) |
| Set the center of mass of the body (in local-space coordinates) More... | |
| void | updateLocalCenterOfMassFromColliders () |
| Compute and set the local-space center of mass of the body using its colliders. More... | |
| void | updateLocalInertiaTensorFromColliders () |
| Compute and set the local-space inertia tensor of the body using its colliders. More... | |
| void | updateMassFromColliders () |
| Compute and set the mass of the body using its colliders. More... | |
| void | updateMassPropertiesFromColliders () |
| Compute and set the center of mass, the mass and the local-space inertia tensor of the body using its colliders. More... | |
| BodyType | getType () const |
| Return the type of the body. More... | |
| void | setType (BodyType type) |
| Set the type of the body. More... | |
| bool | isGravityEnabled () const |
| Return true if the gravity needs to be applied to this rigid body. More... | |
| void | enableGravity (bool isEnabled) |
| Set the variable to know if the gravity is applied to this rigid body. More... | |
| decimal | getLinearDamping () const |
| Return the linear velocity damping factor. More... | |
| void | setLinearDamping (decimal linearDamping) |
| Set the linear damping factor. More... | |
| decimal | getAngularDamping () const |
| Return the angular velocity damping factor. More... | |
| void | setAngularDamping (decimal angularDamping) |
| Set the angular damping factor. More... | |
| void | applyForceToCenterOfMass (const Vector3 &force) |
| Apply an external force to the body at its center of mass. More... | |
| void | applyForceAtLocalPosition (const Vector3 &force, const Vector3 &point) |
| Apply an external force to the body at a given point (in local-space coordinates). More... | |
| void | applyForceAtWorldPosition (const Vector3 &force, const Vector3 &point) |
| Apply an external force to the body at a given point (in world-space coordinates). More... | |
| void | applyTorque (const Vector3 &torque) |
| Apply an external torque to the body. More... | |
| bool | isAllowedToSleep () const |
| Return whether or not the body is allowed to sleep. More... | |
| void | setIsAllowedToSleep (bool isAllowedToSleep) |
| Set whether or not the body is allowed to go to sleep. More... | |
| bool | isSleeping () const |
| Return whether or not the body is sleeping. More... | |
| virtual void | setIsActive (bool isActive) override |
| Set whether or not the body is active. More... | |
| virtual Collider * | addCollider (CollisionShape *collisionShape, const Transform &transform) override |
| Create a new collider and add it to the body. More... | |
| virtual void | removeCollider (Collider *collider) override |
| Remove a collider from the body. More... | |
| Public Member Functions inherited from reactphysics3d::CollisionBody | |
| CollisionBody (PhysicsWorld &world, Entity entity) | |
| Constructor. More... | |
| virtual | ~CollisionBody () |
| Destructor. | |
| CollisionBody (const CollisionBody &body)=delete | |
| Deleted copy-constructor. | |
| CollisionBody & | operator= (const CollisionBody &body)=delete |
| Deleted assignment operator. | |
| Entity | getEntity () const |
| Return the corresponding entity of the body. More... | |
| bool | isActive () const |
| Return true if the body is active. More... | |
| void * | getUserData () const |
| Return a pointer to the user data attached to this body. More... | |
| void | setUserData (void *userData) |
| Attach user data to this body. More... | |
| const Transform & | getTransform () const |
| Return the current position and orientation. More... | |
| bool | testPointInside (const Vector3 &worldPoint) const |
| Return true if a point is inside the collision body. More... | |
| bool | raycast (const Ray &ray, RaycastInfo &raycastInfo) |
| Raycast method with feedback information. More... | |
| bool | testAABBOverlap (const AABB &worldAABB) const |
| Test if the collision body overlaps with a given AABB. More... | |
| AABB | getAABB () const |
| Compute and return the AABB of the body by merging all colliders AABBs. More... | |
| const Collider * | getCollider (uint colliderIndex) const |
| Return a const pointer to a given collider of the body. More... | |
| Collider * | getCollider (uint colliderIndex) |
| Return a pointer to a given collider of the body. More... | |
| uint | getNbColliders () const |
| Return the number of colliders associated with this body. More... | |
| Vector3 | getWorldPoint (const Vector3 &localPoint) const |
| Return the world-space coordinates of a point given the local-space coordinates of the body. More... | |
| Vector3 | getWorldVector (const Vector3 &localVector) const |
| Return the world-space vector of a vector given in local-space coordinates of the body. More... | |
| Vector3 | getLocalPoint (const Vector3 &worldPoint) const |
| Return the body local-space coordinates of a point given in the world-space coordinates. More... | |
| Vector3 | getLocalVector (const Vector3 &worldVector) const |
| Return the body local-space coordinates of a vector given in the world-space coordinates. More... | |
This class represents a rigid body of the physics engine.
A rigid body is a non-deformable body that has a constant mass. This class inherits from the CollisionBody class.
| RigidBody::RigidBody | ( | PhysicsWorld & | world, |
| Entity | entity | ||
| ) |
Constructor.
| transform | The transformation of the body |
| world | The world where the body has been added |
| id | The ID of the body |
|
overridevirtual |
Create a new collider and add it to the body.
This method will return a pointer to a new collider.
A collider is an object with a collision shape that is attached to a body. It is possible to attach multiple colliders to a given body. You can use the returned collider to get and set information about the corresponding collision shape for that body.
| collisionShape | A pointer to the collision shape of the new collider |
| transform | The transformation of the collider that transforms the local-space of the collider into the local-space of the body |
Reimplemented from reactphysics3d::CollisionBody.
Apply an external force to the body at a given point (in local-space coordinates).
If the point is not at the center of mass of the body, it will also generate some torque and therefore, change the angular velocity of the body.
If the body is sleeping, calling this method will wake it up. Note that the force will we added to the sum of the applied forces and that this sum will be reset to zero at the end of each call of the PhyscisWorld::update() method. You can only apply a force to a dynamic body otherwise, this method will do nothing.
| force | The force to apply on the body (in Newtons) |
| point | The point where the force is applied (in local-space coordinates) |
Apply an external force to the body at a given point (in world-space coordinates).
If the point is not at the center of mass of the body, it will also generate some torque and therefore, change the angular velocity of the body.
If the body is sleeping, calling this method will wake it up. Note that the force will we added to the sum of the applied forces and that this sum will be reset to zero at the end of each call of the PhyscisWorld::update() method. You can only apply a force to a dynamic body otherwise, this method will do nothing.
| force | The force to apply on the body (in Newtons) |
| point | The point where the force is applied (in world-space coordinates) |
| void RigidBody::applyForceToCenterOfMass | ( | const Vector3 & | force | ) |
Apply an external force to the body at its center of mass.
If the body is sleeping, calling this method will wake it up.
Note that the force will we added to the sum of the applied forces and that this sum will be reset to zero at the end of each call of the PhyscisWorld::update() method. You can only apply a force to a dynamic body otherwise, this method will do nothing.
| force | The external force to apply on the center of mass of the body (in Newtons) |
| void RigidBody::applyTorque | ( | const Vector3 & | torque | ) |
Apply an external torque to the body.
If the body is sleeping, calling this method will wake it up.
Note that the force will we added to the sum of the applied torques and that this sum will be reset to zero at the end of each call of the PhyscisWorld::update() method. You can only apply a force to a dynamic body otherwise, this method will do nothing.
| torque | The external torque to apply on the body |
| void RigidBody::enableGravity | ( | bool | isEnabled | ) |
Set the variable to know if the gravity is applied to this rigid body.
| isEnabled | True if you want the gravity to be applied to this body |
| decimal RigidBody::getAngularDamping | ( | ) | const |
Return the angular velocity damping factor.
| Vector3 RigidBody::getAngularVelocity | ( | ) | const |
Return the angular velocity.
| decimal RigidBody::getLinearDamping | ( | ) | const |
Return the linear velocity damping factor.
| Vector3 RigidBody::getLinearVelocity | ( | ) | const |
Return the linear velocity.
| const Vector3 & RigidBody::getLocalCenterOfMass | ( | ) | const |
Return the center of mass of the body (in local-space coordinates)
| const Vector3 & RigidBody::getLocalInertiaTensor | ( | ) | const |
Return the local inertia tensor of the body (in body coordinates)
| decimal RigidBody::getMass | ( | ) | const |
Return the mass of the body.
| BodyType RigidBody::getType | ( | ) | const |
Return the type of the body.
| bool RigidBody::isAllowedToSleep | ( | ) | const |
Return whether or not the body is allowed to sleep.
| bool RigidBody::isGravityEnabled | ( | ) | const |
Return true if the gravity needs to be applied to this rigid body.
| bool RigidBody::isSleeping | ( | ) | const |
Return whether or not the body is sleeping.
|
overridevirtual |
Remove a collider from the body.
To remove a collider, you need to specify its pointer.
| collider | The pointer of the collider you want to remove |
Reimplemented from reactphysics3d::CollisionBody.
| void RigidBody::setAngularDamping | ( | decimal | angularDamping | ) |
Set the angular damping factor.
| angularDamping | The angular damping factor of this body |
| void RigidBody::setAngularVelocity | ( | const Vector3 & | angularVelocity | ) |
Set the angular velocity.
| angularVelocity | The angular velocity vector of the body |
|
overridevirtual |
Set whether or not the body is active.
| isActive | True if you want to activate the body |
Reimplemented from reactphysics3d::CollisionBody.
| void RigidBody::setIsAllowedToSleep | ( | bool | isAllowedToSleep | ) |
Set whether or not the body is allowed to go to sleep.
| isAllowedToSleep | True if the body is allowed to sleep |
| void RigidBody::setLinearDamping | ( | decimal | linearDamping | ) |
Set the linear damping factor.
| linearDamping | The linear damping factor of this body |
| void RigidBody::setLinearVelocity | ( | const Vector3 & | linearVelocity | ) |
Set the linear velocity of the body.
| linearVelocity | Linear velocity vector of the body |
| void RigidBody::setLocalCenterOfMass | ( | const Vector3 & | centerOfMass | ) |
Set the center of mass of the body (in local-space coordinates)
This method does not move the rigid body in the world.
| centerOfMass | The center of mass of the body in local-space coordinates |
| void RigidBody::setLocalInertiaTensor | ( | const Vector3 & | inertiaTensorLocal | ) |
Set the local inertia tensor of the body (in body coordinates)
Note that an inertia tensor with a zero value on its diagonal is interpreted as infinite inertia.
| inertiaTensorLocal | A vector with the three values of the diagonal 3x3 matrix of the local-space inertia tensor |
| void RigidBody::setMass | ( | decimal | mass | ) |
Set the mass of the rigid body.
Note that a mass of zero is interpreted as infinite mass.
| mass | The mass (in kilograms) of the body |
|
overridevirtual |
Set the current position and orientation.
| transform | The transformation of the body that transforms the local-space of the body into world-space |
Reimplemented from reactphysics3d::CollisionBody.
| void RigidBody::setType | ( | BodyType | type | ) |
Set the type of the body.
The type of the body can either STATIC, KINEMATIC or DYNAMIC as described bellow: STATIC : A static body is simulated as if it has infinite mass, zero velocity but its position can be changed manually.
A static body does not collide with other static or kinematic bodies. KINEMATIC : A kinematic body is simulated as if it has infinite mass, its velocity can be changed manually and its position is computed by the physics engine. A kinematic body does not collide with other static or kinematic bodies. DYNAMIC : A dynamic body has non-zero mass, its velocity is determined by forces and its position is determined by the physics engine. A dynamic body can collide with other dynamic, static or kinematic bodies.
| type | The type of the body (STATIC, KINEMATIC, DYNAMIC) |
| void RigidBody::updateLocalCenterOfMassFromColliders | ( | ) |
Compute and set the local-space center of mass of the body using its colliders.
This method uses the shape, mass density and transforms of the colliders to set the center of mass of the body.
Note that calling this method will overwrite the mass that has been previously set with the RigidBody::setCenterOfMass() method. Moreover, this method does not use the mass set by the user with the RigidBody::setMass() method to compute the center of mass but only the mass density and volume of the colliders.
| void RigidBody::updateLocalInertiaTensorFromColliders | ( | ) |
Compute and set the local-space inertia tensor of the body using its colliders.
This method uses the shape, mass density and transforms of the colliders to set the local-space inertia tensor of the body.
Note that calling this method will overwrite the mass that has been set with the RigidBody::setInertiaTensorLocal() method.
| void RigidBody::updateMassFromColliders | ( | ) |
Compute and set the mass of the body using its colliders.
This method uses the shape, mass density and transforms of the colliders to set the total mass of the body.
Note that calling this method will overwrite the mass that has been set with the RigidBody::setMass() method
| void RigidBody::updateMassPropertiesFromColliders | ( | ) |
Compute and set the center of mass, the mass and the local-space inertia tensor of the body using its colliders.
This method uses the shape, mass density and transform of the colliders of the body to set the total mass, the center of mass and the local inertia tensor of the body.
Note that calling this method will overwrite the mass that has been set with the RigidBody::setMass(), the center of mass that has been set with RigidBody::setCenterOfMass() and the local inertia tensor that has been set with RigidBody::setInertiaTensorLocal().