Woocommerce product price calculation based on area and perimeter dimensions - wordpress

Please advise what plugin would be suitable for the following calculations below:
Product Rectangle:
a = length
b = width
p1 = price per sq m (area)
p2 = price per m (perimeter)
Calculation based on the total area of product a x b x p1 = x
Calculation based on product perimeter (2a + 2b) x p2 = y
Total price = x + y
WooCommerce Measurement Price Calculator is a great plugin but unfortunately can not be set in order to add two Prices based on two parameters. It is possible that this calculation can be achieved by another plugin? Maybe other then WMPC or Gravity Forms?

I don't think there is a plugin that does that specific set of calculations. I would recommend thinking outside the box a bit. If I were trying to accomplish this, I probably would use the Price Calculator plugin and use the Composite plugin. Then setup a single, hidden, product for each calculation you're looking to do. Then setup the composite product to include both. That way you can calculate the individual product equations and then have the grand total be calculated in the end. To me, that would be the simplest solution.

Even though this is an old post I think the Plugin Product Price by Formula for WooCommerce might be a possible solution.
The short Documentation on the Product page is very good. Pro version is not needed for many use cases. You could use the following formula:
([product_width]*[product_height]*p1)+((2*[product_width]+2*[product_height])*p2)
[product_width] and [product_height] are just that.
p1 and p2 can be defined as parameters in the plugin's settings / formula editor.

Related

Get the trajectory of the rocket

I need to mathematically (or otherwise) get the 3D trajectory of the rocket. I have several variables: starting position, landing position, maximum altitude, flight angle. Here is a demo:
And yes, I don't use any popular game engine, I use the Lua language, on the MTA engine (MultiTheftAuto GTA SA). I want to get this trajectory mathematically. I need a set of points. Or if you are familiar with this engine, explain to me how to implement such a flight in the MTA. But you can also show me how this problem can be solved mathematically, or in any other languages ​​and even using the built-in functions of these engines, I will convert the code for Lua and find the implementation of your engine functions on the Internet. Thank you!
EDIT
And yes, I need to change exactly the Y coordinate (height) I have X and Z. I have a loop that every meter of the current trajectory goes through, in this cycle I have a variable X and Z , and I need to get Y based on these variables .
// float x = 0.0 - 1.0
y = sin(x * pi) ^ 0.6

Turning a band of Sentinel 2 image into an array

I am new to Google Earth Engine and have started playing with mathematically combining different bands to define new index. The problem I am having is the visualisation of the new index - I need to define the max and min parameter when adding it to the map, and I am having troubles understanding what these two end points should be. So here come my two questions:
Is it possible to get the matrix of my image in terms of pixel values? Then I could easily see from what values they range and hence could define min and max!
What values are taken in different bands? Is it from 0 to 1 and measures intensity at given wavelength, or is it something else?
Any help would be much appreciated, many thanks in advance!
Is it possible to get the matrix of my image in terms of pixel values? Then I could easily see from what values they range and hence could define min and max!
If this is what you want to do, there's a built in way to do it. Go to the layer list, click on the gear for the layer, and in the “Range” section, pick one of the “Stretch:” options from the menu, then click “Apply”. You can choose a range in standard deviations, or 100% (min and max).
You can then use the “Import” button to save these parameters as a value you can use in your script.
(All of this applies to the region of the image that's currently visible on screen — not the entire image.)
What values are taken in different bands? Is it from 0 to 1 and measures intensity at given wavelength, or is it something else?
This is entirely up to the individual dataset you are using; Earth Engine only knows about numbers stored in bands and not units of measure or spectra. There may be sufficient information in the dataset's description in the data catalog, or you may need to consult the original provider's documentation.

get all the harmonics from a wave

I need to filter the harmonics of an audio track using the libraries 'seewave' and 'tuneR' of R, but I do not know the functions of this language well.
So far I have done the following:
library('seewave')
library('tuneR')
track<-readMP3('empty_spaces.mp3')
t1<-cutw(track, from=0, to=10)
autoc(t1, f=4400)
and the result is the next screen:
at first I thought that the group of points on the bottom were the harmonics and the points isolated above belonged to noise, but I think I'm not interpreting it well. Could someone help me interpret this image? or tell me what function would help me get what I need?
Thank you
This is image of distribution of frequencies across time, so by this image it s hard to see, where noise and where useful signal. To solve your problem, you should use frequency filters , chebyhev or butterworth filters (look at filter function in signal package) and of course you must know what frequencies you want to delete.

How do I calculate the Minkowski Difference between two AABBs (with no vector math)?

I'm implementing the second version of my collision detection library. This particular library should deal with axis-aligned boxes (AABBs). I'd like to start tracking fast-moving boxes on this version. I think calculating the Minkowski Difference between the two would be a good starting point for that.
When I say Minkowsky Difference I mean the geometric operation described in Collision detection for Dummies.
The catch is: The process and algorithm described there is very generic. It uses fairly advanced vector math to calculate the MD of any two polygons.
In my case I have AABBs. Given their numerical simplicity, the library so far has not needed a Vector concept - for example, I have not needed to compute a single dot product. I'd like it to stay that way if at all possible.
So my question is:
Given two AABBs by their top,left,width and height ({t1,l1,w1,h1} and {t2,l2,w2,h2}), how do I calculate their MD, (without getting vector math if possible)?
Just by playing with the widget on Collision detection for Dummies, I'm almost certain that the MD width will be a box of width w1+w2 and height h1+h2. But I have no idea about how to calculate its top or left corner.
The Minkowski difference for two axes-aligned rectangles {t1, l1, w1, h1} and {t2, l2, w2, h2} is itself an axes-aligned rectangle:
l = l1 - l2 - w2
t = t2 - t1 - h1
w = w1 + w2
h = h1 + h2
The following is a short javascript demo to show this in action. You can drag any of the two rectangles. They will change color when overlapping
Demo: http://jsbin.com/afojes/2/
Code: http://jsbin.com/afojes/2/edit

How do I set the upper and lower bounds of a dynamic graph?

Say I want to display a graph of today's stock market. I gather all my data, and I go to display the graph...is there a well known formula to set the upper and lower bounds to?
Do I need to factor in all the data on the stock market from the last year to get some context?
In some ways this is a design/math question, but essentially, I want to know, is there a well known formula for making graphs for things like network traffic and visitor counts intuitive to read?
Maybe I'm underestimating your problem, but if you just want to show absolute movement, why not do something like
factor = 0.1 # e.g.
todays_span = todays_max - todays_min
lower_bound = todays_min - factor * todays_span
upper_bound = todays_max + factor * todays_span
to fit the curve and leave some space above and below? If you need the user to see relative changes, you have to set the lower bound to zero.

Resources